Research Article

A Proposed Harmony Search Algorithm for Honeyword Generation

Algorithm 2

The proposed harmony search algorithm.
Parameter
n pitches size (population-size), HS harmony size (number of pitches that made harmony), HM harmony memory, HMS harmony memory size (equal to the max-generation), HMCR harmony memory considering rate, PAR pitch adjusting rate, bw distance bandwidth (the maximum pitch adjustment change), ap number of generated adjacent pitches, Mg max-generation, Ec evaluation criteria, d number of the generated digits tokens, dl number of digits that changed in the generated token, s number of the generated special characters tokens, sl number of special characters that changed in the generated token.
Begin
Tokenization/  parse the sugarword to the alphabet of, numbers, and special characters token   /
If the token is an alphabet
  Generate the initial pitches population with n randomly
  Compute the fitness of the population with considering to Ec
  for i = 1 to Mg
   for j = 1 to n
    Generate rand1 in range (0, 1) and HMCR random in range (0, 1)
     if rand < HMCR
      let a pitch selected form the population randomly
      Generate rand2 in range (0, 1) and PAR random in range (0, 1)
      if rand < PAR
      Generate adjacent pitches with ap respect to bw and choose the best adjacent as the pitch
      end if
     else generate pitch randomly
     end if
   end for
    Compute the fitness of the new population with considering to Ec
    Drop the worst pitches of the population generate ones randomly
    Select the best pitches with HS as the harmony then save in HM
  end for
  Return the best harmony in HM as the alphabet honeyword tokens
end if
If the token is a digit
  for i = 1 to d
   for j = 1 to dl
    Changes the digits of the token by other digits randomly
   end for
  end for
  Return the d tokens as the digits honeyword tokens
end if
If the token is a special character
  for i = 1 to s
   for j = 1 to sl
    Changes the special characters of the token by other special characters randomly
   end for
  end for
  Return the s tokens as the special characters honeyword tokens
end if
Collect honeyword tokens
Provide sweetwords by adding sugarword to honeywords then permutate and hashed the sweetwords
End