Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Catalog · How the catalog works

Random project

pascal-md5

MD5 hash function in Pascal for no good reason

View on GitHub

Anyone may press Interesting, signed in or not. It helps others find this project.

Member rating

No ratings yet.

Sign in to rate this project.

README

pascal-md5

MD5 hash function in Pascal for no good reason.

I didn't really feel like working on my current hobby projects and a Pascal book on my shelf caught my eye. So why not learn a bit of Pascal and how the MD5 hashing function works.

Test Output

txt
""
  actual:   0xd41d8cd98f00b204e9800998ecf8427e
  expected: 0xd41d8cd98f00b204e9800998ecf8427e

"a"
  actual:   0x0cc175b9c0f1b6a831c399e269772661
  expected: 0x0cc175b9c0f1b6a831c399e269772661

"abc"
  actual:   0x900150983cd24fb0d6963f7d28e17f72
  expected: 0x900150983cd24fb0d6963f7d28e17f72

"message digest"
  actual:   0xf96b697d7cb7938d525a2f31aaf161d0
  expected: 0xf96b697d7cb7938d525a2f31aaf161d0

"abcdefghijklmnopqrstuvwxyz"
  actual:   0xc3fcd3d76192e4007dfb496cca67e13b
  expected: 0xc3fcd3d76192e4007dfb496cca67e13b

"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"
  actual:   0xd174ab98d277d9f5a5611c2c9f419d9f
  expected: 0xd174ab98d277d9f5a5611c2c9f419d9f

"12345678901234567890123456789012345678901234567890123456789012345678901234567890"
  actual:   0x57edf4a22be3c955ac49da2e2107b67a
  expected: 0x57edf4a22be3c955ac49da2e2107b67a

Commands

  • make build - builds binary
  • make run - builds and runs binary

Dependencies

Free Pascal 3.2.2+ - sudo apt-get -y install fpc

References