I'm making a php login, and I'm trying to decide whether to use SHA1 or Md5, or SHA256 which I read about in another stackoverflow article. Are any of them more secure than others? For SHA1/256, do I still use a salt?
Also, is this a secure way to store the password as a hash in mysql?
function createSalt(){ $string = md5(uniqid(rand(), true)); return substr($string, 0, 3);}$salt = createSalt();$hash = sha1($salt . $hash);
Just wonder if it's possible to generate a unique hash of every checkout-webpage that is live on a webserver. In terminal i can create a SHA-1 key by using the command:
curl www.mysuperduerwebdomain.com/index.php | openssl sha1 -binary | base64
that generates:
% Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed100 13134 100 13134 0 0 222k 0 --:--:-- --:--:-- --:--:-- 225k
40Sw9Z/0COwZhLoVPesahtaib0E=
If i put this generated hash into a myslq table, and it's compared every time the webpage loads to the generated SHA-1 key at that moment, and both are the same, the content of the loaded checkout page is the same. (and no malicious javascript code was embedded for instance.) Have i got the theory right?
I have done a script in Python which is:
hashed_string = hashlib.sha1(str(string_to_hash).encode('utf-8')).hexdigest()
and it works as I want, but I can't figure out how to do it in JavaScript.I have done this in JS:
const crypto = require('crypto') let shasum = crypto.createHash('sha1') let hashed_string = shasum.update(JSON.stringify(string_to_hash).digest('hex'))
But the result is not the same. Can anyone help me please?
Below i had encrypted a string varible using sha1. And now i would wish to decrypt data using sha1 function, but am going some where. Would some one come forward and guide me in proper way please.
Below is my code
<?php $variable = "tiger"; echo $variable; $encrypt = sha1($variable); echo $encrypt; $decrypt = sha1($encrypt); echo $decrypt; ?>
And i get output like this
tiger46e3d772a1888eadff26c7ada47fd7502d796e07989df2c8b5ea37eb7cfde0527d94c01a15257002
I'm storing the user password on the db as a sha1 hash.
Unfortunately I'm getting strange answers.
I'm storing the string as this:
MessageDigest cript = MessageDigest.getInstance("SHA-1"); cript.reset(); cript.update(userPass.getBytes("utf8")); this.password = new String(cript.digest());
I wanted something like this -->
aff --> "0c05aa56405c447e6678b7f3127febde5c3a9238"
rather than
aff --> �V@\D~fx����:�8
Acasă - Harta site-ului - Intimitate - Site-uri - Copyright © 2019 Cortex IT SRL : Contact : admin @ cortexit.co.uk
Please note that by viewing our site you agree to our use of cookies (see Intimitate for details). You will only see this message once.