• # en bash

    Posté par . En réponse au journal ghash: génération d'image à partir d'un hash. Évalué à 7.

    très sympa !

    comme je trouve qu'installer golang pour lancer un exe est un peu too much,
    voici une version (non exacte) en bash :

    #!/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

    hello world

    linuxfr.org

    PS : comme l'indique ton wrapper go, il faut une version récente de gmic. La 1.6.8 inclue dans debian stable ne comprend pas "-solidify". J'ai pris la dernière version statique disponible sur le site de gmic.