This repository has been archived by the owner on Aug 22, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 264
How to hash & salt in various languages.
Gioyik edited this page Nov 12, 2012
·
3 revisions
<?php
function hashEmailAddress($email, $salt) {
return 'sha256$' . hash('sha256', $email . $salt);
}
?>
require 'digest'
def hashEmailAddress(email, salt)
'sha256$' + Digest::SHA256.hexdigest(email + salt)
end
import hashlib
def hashEmailAddress(email, salt):
return 'sha256$' + hashlib.sha256(email + salt).hexdigest();
#!/usr/bin/python
import hashlib
email = raw_input('Email address? ')
salt = '#ioe12'
hash = hashlib.sha256(email + salt)
print (salt.encode('hex'), hash.hexdigest())
var crypto = require('crypto');
function hashEmailAddress(email, salt) {
var sum = crypto.createHash('sha256');
sum.update(email + salt);
return 'sha256$'+ sum.digest('hex');
}