コード例 #1
0
ファイル: test_password.py プロジェクト: killerswan/triad
   def test_too_many_words_requested(self):
      '''
      Test for problems with too little "entropy"

      Words are chosen with a fraction of the bytes from scrypt.
      The more words requested, the smaller the number of bytes each.
      If too small, only a portion of the vocabulary could be reached,
      and that would be uncool.
      '''

      vocabulary = map(str, range(2**16))

      # OK: each word is chosen with >=2 bytes - OK for 2**16
      generate(vocabulary, 'one', 'two', n=32)

      # BAD: each word is chosen with <=1 byte - BAD for 2**16
      self.assertRaises(Exception, generate, vocabulary, 'one', 'two', n=33)
コード例 #2
0
ファイル: demo.py プロジェクト: killerswan/triad
 def gen(self, key0, key1, n=5, hexSep=False):
     return generate(self.words, key0, key1, n, hexSep)