Daily Shaarli

All links of one day in a single page.

November 8, 2016

ghash: génération d'image à partir d'un hash - LinuxFr.org

une version en go et une version en shell :

!/bin/bash

function hache {
sha512sum <(echo -n "$1") | cut -d\ -f1
}

function geninput {
md1=$(hache "$1")
md2=$(hache "$md1")
(echo "scale=5"; echo -n "$md1$md2" | fold -w 8 | head -n 23 | while read h;
do
echo "$(( 0x$h + 0 )) / 2^32"
done) | bc | tr '\n' ','
}

o=${2-ghash.jpg}
s=${3-32}

./gmic ghash.gmic -ghash $s,$(geninput "$1") -o $o

Oh, shit, git!

un helper qui va bien sur git en cas de crise