hosh icon indicating copy to clipboard operation
hosh copied to clipboard

encoders and hashing

Open dfa1 opened this issue 6 years ago • 1 comments

Problem

In https://github.com/golang-migrate/migrate/blob/master/README.md contains this:

It's easiest to always run the URL parts of your DB connection URL (e.g. username, password, etc) through an URL encoder. See the example Python snippets below:

$ python3 -c 'import urllib.parse; print(urllib.parse.quote(input("String to encode: "), ""))'
String to encode: FAKEpassword!#$%&'()*+,/:;=?@[]
FAKEpassword%21%23%24%25%26%27%28%29%2A%2B%2C%2F%3A%3B%3D%3F%40%5B%5D
$ python2 -c 'import urllib; print urllib.quote(raw_input("String to encode: "), "")'
String to encode: FAKEpassword!#$%&'()*+,/:;=?@[]
FAKEpassword%21%23%24%25%26%27%28%29%2A%2B%2C%2F%3A%3B%3D%3F%40%5B%5D
$

this is suboptimal for several reasons (e.g. requires python, verbosity, hard to read).

Solution

Provide commands for encode/decode (URL, base64, etc) and hashing (md5, sha1, sha2) by using Java classes e.g. Base64 or MessageDigest.

Benefit Easy to use and portable commands for encoding, decoding and hashing.

dfa1 avatar May 21 '19 06:05 dfa1

  • [ ] base64
  • [ ] md5
  • [ ] sha1
  • [ ] sha2

dfa1 avatar Jun 14 '20 15:06 dfa1