 
 config =
 	pw: { min_size: 8, max_size: 16 }
-
-is_upper = (c) -> "A".charCodeAt(0) <= c and c <= "Z".charCodeAt(0)
-is_lower = (c) -> "a".charCodeAt(0) <= c and c <= "z".charCodeAt(0)
-is_digit = (c) -> "0".charCodeAt(0) <= c and c <= "9".charCodeAt(0)
-is_valid = (c) -> @is_upper(c) or @is_lower(c) or @is_digit (c)
 
 class PasswdGenerator
 	constructor: (@email, passphrase, itercnt) ->
 		# TODO If localStorage has stored key, no need to generate again
 		@_key = @derive(@email, passphrase)
 
-	# Private function
 	derive: (email, passphrase, itercnt) ->
+		# TODO check if the derived key is the same as 1SP
 		C.PBKDF2 passphrase, email,
 			{ keySize: 512/32, iterations: itercnt, hasher: C.algo.SHA512 }
 

		i = 0
		ret = null
		tmpl = [ "OneShallPass v2.0", @email, passwd.site, passwd.generation ].join ""
		k = C.HmacSHA512 tmpl.concat("0"), @_key
		k = k.toString C.enc.Base64
		k[0...passwd.length]
		# until ret
		# 	a = tmpl.concat(i.toString())
		# 	hash = C.HmacSHA512 a, @_key
		# 	b64 = hash.toString C.enc.Base64
		# 	ret = b64 if @is_ok_pw b64, passwd
		# 	i++
		# x = @add_syms ret, passwd.num_symbols
		# x[0...passwd.length]

	# Rules for 'OK' passwords:
	#    - Within the first 8 characters:

		arr.push input[last...]
		arr.join ""

	is_upper: (c) -> "A".charCodeAt(0) <= c and c <= "Z".charCodeAt(0)
	is_lower: (c) -> "a".charCodeAt(0) <= c and c <= "z".charCodeAt(0)
	is_digit: (c) -> "0".charCodeAt(0) <= c and c <= "9".charCodeAt(0)
	is_valid: (c) -> @is_upper(c) or @is_lower(c) or @is_digit (c)

window.PasswdGenerator = PasswdGenerator
