How to generate signed hash for a file in a Windows or Linux environment learn step by step in this article.
Overview of generate signed hash for a file
Let me explain how to generate a signed hash file. But before moving to the process of generation of signed hash let me explain what is the purpose of the signed hash.
Today, if anyone writes code and wants to identify, is the same code that he/she write no change has been done in his/her initial code. In that case, the user should write the code and generate the hash of her/her code file and share the code with anyone. And match the hash of file share before sharing and after.
So let me quickly explain how to generate signed hash file. Run below command it will generate a hash of file.
In windows: Generate signed Hash
certutil -hashfile filename.war MD5 certutil -hashfile filename.txt MD5 certutil -hashfile filename.dll MD5
File hash generated before share or deploy to anywhere
> certutil -hashfile filename.txt MD5 MD5 hash of file filename.txt: b3 26 5d 69 eb 69 a8 f2 91 10 81 4a d9 7a 26 e4 CertUtil: -hashfile command completed successfully.
User modify some changes in file and share of file also changes:-
> certutil -hashfile filename.txt MD5 MD5 hash of file filename.txt: fa e0 6c 69 17 0a 41 e5 20 ae 25 66 50 57 27 08 CertUtil: -hashfile command completed successfully.
In Linux Env: generate signed hash
md5sum – compute and check MD5 message digest
md5sum is used to compute check sum of a file same as certutil command in linux.
Let me explain how to use md5sum command in linux
Linux >md5sum test.c 4bc576d6aa56ecf9db5a0d99b78d789f test.c Linux >
1. Create file, to let me create a text file having some content
Linux >vim test.txt
2. Compute check of test file.
Linux >md5sum test.txt b74ed347390d35c29923e80f64c9d904 test.txt
or we can save that in a file
Linux > md5sum test.c >; test.c.md5 Linux >vim test.c.md5
Validate from checksum save in file:-
Linux >md5sum -c test.c.md5 test.c: OK
Let me modify the content of file and validate the checksum again:-
Linux >md5sum -c test.c.md5 test.c: FAILED md5sum: WARNING: 1 computed checksum did NOT match
This command is used by auditor to take the hash of code, and it will be as proof that there is no change in code after audit process.
Happy learning 🙂
3 thoughts on “How to generate signed hash for a file in window or linux env.”
I think this is one of the most significant information for me.
And i’m glad reading your article. But should remark on few general
things, The site style is great, the articles is really
nice : D. Good job, cheers
Aw, this was an exceptionally good post.
Finding the time and actual effort to make a very goodd article… but what can I say… I
put thongs off a whole lot and never manage to get anything done.
I?m not that much of a online reader to be honest but your blogs really nice, keep it up!
I’ll go ahead and bookmark your website to come back
later. All the best