Announcing paperbackup.py to backup keys as QR codes on paper
Peter Lebbing
peter at digitalbrains.com
Fri Feb 24 17:21:38 CET 2017
Crap, silly me... why do I always notice these things only after I've
hit send?
On 24/02/17 17:17, Peter Lebbing wrote:
> The following Python:
>
>>>> from posixcksum import PosixCkSum
>>>> from base64 import b64encode
>>>> crc, _ = PosixCkSum.sum_whole(bytearray(b'123456789'))
>>>> b64encode(crc.to_bytes(4,byteorder='big'))[:4]
> b'N3pg'
Let's make that:
>>> from posixcksum import PosixCkSum
>>> from base64 import b64encode
>>> crc, _ = PosixCkSum.sum_whole(bytearray(b'123456789'))
>>> print(b64encode(crc.to_bytes(4,byteorder='big'))[:6])
b'N3pgEQ'
> $ printf $(printf '%08x' $(echo -n 123456789 | cksum | cut -d' ' -f1) | sed 's/../\\x\0/g')|base64|cut -b-4
> N3pg
And this one:
$ printf $(printf '%08x' $(echo -n 123456789 | cksum | cut -d' ' -f1) |
sed 's/../\\x\0/g')|base64|cut -b-6
N3pgEQ
Oh, and by the way, when the python module is invoked as the main
module, it mimics the working of cksum, so the following two are roughly
equivalent:
$ cksum *.c
$ posixcksum.py *.c
HTH,
Peter.
--
I use the GNU Privacy Guard (GnuPG) in combination with Enigmail.
You can send me encrypted mail if you want some privacy.
My key is available at <http://digitalbrains.com/2012/openpgp-key-peter>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: </pipermail/attachments/20170224/3e557f99/attachment.sig>
More information about the Gnupg-users
mailing list