md5sum (RFC1321) in Go This is part of a TH-Rosenheim module. The counterpart is located at https://github.com/TripleTrable/md5sum.git
To build the project, go into the go folder and there run:
$ go build .
After the build the md5sum executable can be used or maunally installed.
The usage is the same as for the common GNU md5sum version with some exceptions.
Currently, the only working flag is -c
as the --text
and
--binary
flags are not used on Unix systems.
###Example:
Get MD5 hash from the file foo.bar
$ md5sum foo.bar
dd32876efbff8edb1a41f81b9b0fc57b foo.bar
Use md5 file to check a list of files
$ md5sum -c foo.md5
foo.bar: OK
As seen from the above image, the md5 algorithm iterates over the message in 512
bit chunks. Each chunk is then processed in a so-called round before beeing used
again with a new chunk.
The Algorithm uses 4 functions which are used on different rounds shown as
F
inside the above diagram. After Adding the result of F
onto Block
A
, the i'th part of the message chunk (M_i
) as well as the constant
K_i
are added to the A
block as well. After the addition the
resulting Block a is shuffeled by a constant each round. Now Block B
is
added onto Block A
and the resulting 4 Blocks are rotated.
Note: All blocks are 32bit large, and the addition is Mod 2^32