I am familiar with how Git creates SHA1 hashes for files (blobs), but not how they are created for tag objects. I assume they are, if I create an annotated tag, but what is the recipe? And how might I replicate it outside of Git (e.g., in Perl or Python)?
The SHA1 hashes stored in the tree objects (as returned by
git ls-tree) do not match the SHA1 hashes of the file content (as returned by
$ git cat-file blob 4716ca912495c805b94a88ef6dc3fb4aff46bf3c | sha1sumde20247992af0f949ae8df4fa9a37e4a03d7063e -
How does git compute file hashes? Does it compress the content before computing the hash?
I need the ruby equivalent of the following:
openssl x509 -sha1 -fingerprint -noout -in cert.pem
The code that I wrote is:
data = File.read("cert.pem")data["-----BEGIN CERTIFICATE-----\n"]=""data["-----END CERTIFICATE-----\n"]=""OpenSSL::Digest::SHA1.new(Base64.encode64(data))
This code does not generate the same fingerprint as the openssl cli command does.
Any idea what I may be doing wrong?
I want python to read to the EOF so I can get an appropriate hash, whether it is sha1 or md5. Please help. Here is what I have so far:
import hashlibinputFile = raw_input("Enter the name of the file:")openedFile = open(inputFile)readFile = openedFile.read()md5Hash = hashlib.md5(readFile)md5Hashed = md5Hash.hexdigest()sha1Hash = hashlib.sha1(readFile)sha1Hashed = sha1Hash.hexdigest()print "File Name: %s" % inputFileprint "MD5: %r" % md5Hashedprint "SHA1: %r" % sha1Hashed
I have a PostgreSQL database, which have many users. Users' passwords are encrypted in this format:
This encryption was done with Django (although I don't know if you can encrypt it directly in database).
What I'm trying to do is make a PHP application that can use and validate these users, with those encrypted passwords.
How could I do it?PS: I'm using PHP 7.