hash_pw() {
echo -n "$1" \
| sha1sum \
| cut -d ' ' -f 1 \
| xxd -r -p \
| base64 \
| sed -e 's/.$//';
}
---
[21:58:21] <kaeza> pitriss, it's because in bash, sha1sum returns the "hexdigest", and not the raw digest
[21:59:06] <kaeza> pitriss, this seems to work: https://gist.github.com/kaeza/34342260f74c1f5683db
[21:59:57] <kaeza> (Minetest base64s the raw bytes of the digest)
[21:59:57] --> Amaz has joined this channel (~Amaz@unaffiliated/amaz).
[22:00:36] <kaeza> use as `my_hash=$(hash_pw "$user$pass")`
--- bash script:
#!/bin/bash
hash_pw() {
echo -n "$1" | sha1sum | cut -d ' ' -f 1 | xxd -r -p | base64 | sed -e 's/.$//';
}
my_hash=$(hash_pw "$1$2")
echo -n $my_hash
bash MT hash generation + script
From pitriss, 2 Days ago, written in Plain Text, viewed 1 times.
This paste is a reply to bash MT hash generation + script from pitriss
- go back
URL http://minetest.wjake.com/stikked/view/78f6901a/diff
Embed
Viewing differences between bash MT hash generation + script and bash MT hash generation + script
— Expand Paste to full width of browser