bash MT hash generation + script

From pitriss, 1 Week 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/9b4a92ad/diff Embed
Viewing differences between bash MT hash generation + script and bash MT hash generation + script
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
digest
[21:59:06] <kaeza> pitriss, this seems to work: https://gist.github.com/kaeza/34342260f74c1f5683db
com/kaeza/34342260f74c1f5683db
[21:59:57] <kaeza> (Minetest base64s the raw bytes of the digest)
digest)
[21:59:57] --> Amaz has joined this channel (~Amaz@unaffiliated/amaz).
(~Amaz@unaffiliated/amaz).
[22:00:36] <kaeza> use as `my_hash=$(hash_pw "$user$pass")`


"$user$pass")`


--- bash script:

#!/bin/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")
"$1$2")
echo -n $my_hash



$my_hash



Reply to "bash MT hash generation + script"

Here you can reply to the paste above