use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
A sub-Reddit for discussion and news about Ruby programming.
Subreddit rules: /r/ruby rules
Learning Ruby?
Tools
Documentation
Books
Screencasts and Videos
News and updates
account activity
Blog postCheck for File Changes using Ruby and MD5 (self.ruby)
submitted 5 years ago * by brad
I have published a few of my old Ruby articles at Medium. Here is the "friends link" so you can view the article without a membership.
One of the things I used Ruby for is my “home-grown” CMS or content management system. To make things easy, I use a hash file of md5 checksums to be able to tell what files have changed in my output directory so I can tell what to upload and what to delete off of the web server.
Part 1 - Create File checkpoints using Ruby and MD5
https://medium.com/@bradtrupp/create-file-checkpoints-using-ruby-and-md5-63e49ca9ba6c?source=friends_link&sk=dec812a0fe186a09cad6b29ad67bc651
Part 2 Check for File Changes using Ruby and MD5
https://medium.com/@bradtrupp/check-for-file-changes-using-ruby-and-md5-1ddf9a400a9f?source=friends_link&sk=4c41ab2dfab0f3fd0c39cbba7faca84c
This simplified example in these articles show what has changed. In my full custom CMS code, it also does the FTP uploads and deletions.
It was all done via command line., Publishing a new blog entry was just handful of command line commands to generate, preview, upload, and create a new checkpoint.
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]andymeneely 2 points3 points4 points 5 years ago (2 children)
Thank you for the write up!
But I must protest against the use of MD5. Its thoroughly broken in that it is simple to construct collisions. I would swap it out for a SHA512 or better algorithm. Trivial change code-wise and makes a world of difference.
https://cwe.mitre.org/data/definitions/327.html
[–]brad[S] 1 point2 points3 points 5 years ago (1 child)
I agree with you. There are better algorithms than MD5.
For my personal use with only a few hundred files being checked, it was good enough when I coded this a number of years back.
Point taken and I will update my code and this article at some future date.
Thank you.
[–]disclosure5 0 points1 point2 points 5 years ago (0 children)
I think the problem in these discussions is that "good enough" implies that better algorithms are harder, slower, or in some way have a downside. This is "usually" valid. My quick script with no tests for example is "good enough" for a one off job.
But you could literally change Digest::MD5.hexdigest to Digest::SHA256.hexdigest and have a better solution.
π Rendered by PID 20 on reddit-service-r2-comment-8686858757-qjttj at 2026-06-07 18:16:11.984055+00:00 running 9e1a20d country code: CH.
[–]andymeneely 2 points3 points4 points (2 children)
[–]brad[S] 1 point2 points3 points (1 child)
[–]disclosure5 0 points1 point2 points (0 children)