Compute MD5 hash of a string


This script computes md5 hashes of striings given as arguments

Requirements



Tested on Linux.

The script (version 1.0.0)


md5string.py (line 1)
  1. #!/usr/bin/env python3
  2.  
  3. #    MD5String - compute md5 hashes of given strings
  4. #    Copyright (C) 2016 Ɓukasz "Cyber Killer" Korpalski
  5. #
  6. #    This program is free software: you can redistribute it and/or modify
  7. #    it under the terms of the GNU General Public License as published by
  8. #    the Free Software Foundation, either version 3 of the License, or
  9. #    (at your option) any later version.
  10. #
  11. #    This program is distributed in the hope that it will be useful,
  12. #    but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. #    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14. #    GNU General Public License for more details.
  15. #
  16. #    You should have received a copy of the GNU General Public License
  17. #    along with this program.  If not, see <http://www.gnu.org/licenses/>.
  18.  
  19. import hashlib,sys,os
  20.  
  21. if len(sys.argv) > 1:
  22.         for msgstring in sys.argv:
  23.                 if msgstring != sys.argv[0]:
  24.                         print(hashlib.md5(msgstring.encode('utf-8')).hexdigest() + "  " + msgstring)
  25. else:
  26.         print("Usage: " + os.path.basename(sys.argv[0]) + " <string1> [string2...]")
  27.         print("(hint: for strings with white characters wrap them in \"\")")


Just click grab to save the file, or copy&paste it yourself to your favorite editor. Remember to add executable permissions.

License


This program is under the GNU GPL v3 or later.


CategoryProjekty

There are no comments on this page. [Add comment]

Valid XHTML 1.0 Transitional :: Valid CSS :: Powered by WikkaWiki