Guest User

Untitled

a guest
Apr 19th, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. password = '1234567890'
  2. salt = '0987654321'
  3. length = 16
  4. iterations = 2
  5.  
  6. $AsciiEncoder = New-Object System.Text.ASCIIEncoding;
  7. $DerivedPass = New-Object System.Security.Cryptography.PasswordDeriveBytes('1234567890', $AsciiEncoder.GetBytes('0987654321'), "SHA1", 2);
  8. [Byte[]] $KeyBytes = $DerivedPass.GetBytes(16);
  9. -join($KeyBytes | ForEach { $_.ToString("X2")});
  10.  
  11. C937511EBDBE12C7A0FCC8D6CB42BEDC
  12.  
  13. from Crypto.Protocol import KDF
  14. from Crypto.Hash import SHA1
  15.  
  16. def password_derive_key(password, salt, length, count):
  17. return KDF.PBKDF2(password, salt, length, count)
  18.  
  19. def main():
  20. derivedKey = password_derive_key('1234567890', '0987654321', 16, 1000)
  21. print derivedKey.encode('hex')
  22.  
  23. if __name__ == "__main__":
  24. main()
  25.  
  26. 42e8bfc7fc5fd4686915d49d5a29bc1e
Add Comment
Please, Sign In to add comment