コード例 #1
0
ファイル: test_pbkdf2.py プロジェクト: nymble/cryptopy
 def pbkdf2KAT(self,testDescription, password, salt, iterations, keySize, ka):
     """ Know Answer Tests from IEEE """
     knownAnswer = a2b_p(ka) # convert ascii 2 binary
     derivedKey = pbkdf2(password, salt, iterations, keySize)
     print "========== %s ==========" % testDescription
     print 'password    = "******"' % password
     print "salt/ssid   = %s" % b2a_pter(salt, frnt='              ')[15:]
     print "iterations  =", iterations
     print "keySize     =", keySize
     print "derivedKey  =", b2a_p(derivedKey, frnt='              ')[15:]
     #print "knownAnswer =", b2a_p(knownAnswer, frnt='              ')[15:]
     self.assertEqual(derivedKey, knownAnswer), "KAT Failed-> %s "% testDescription
コード例 #2
0
 def pbkdf2KAT(self, testDescription, password, salt, iterations, keySize,
               ka):
     """ Know Answer Tests from IEEE """
     knownAnswer = a2b_p(ka)  # convert ascii 2 binary
     derivedKey = pbkdf2(password, salt, iterations, keySize)
     print "========== %s ==========" % testDescription
     print 'password    = "******"' % password
     print "salt/ssid   = %s" % b2a_pter(salt, frnt='              ')[15:]
     print "iterations  =", iterations
     print "keySize     =", keySize
     print "derivedKey  =", b2a_p(derivedKey, frnt='              ')[15:]
     #print "knownAnswer =", b2a_p(knownAnswer, frnt='              ')[15:]
     self.assertEqual(derivedKey,
                      knownAnswer), "KAT Failed-> %s " % testDescription
コード例 #3
0
ファイル: base.py プロジェクト: tjamieg/repository.kodinerds
 def setPassphrase(self, passphrase):
     """ Use pbkdf2 to hash passphrase into a key """
     self.setKey(pbkdf2(passphrase, self.name, 4096, self.keySize))
コード例 #4
0
 def setPassphrase(self,passphrase):
     """ Use pbkdf2 to hash passphrase into a key """
     self.setKey(  pbkdf2( passphrase, self.name, 4096, self.keySize) )