Announcing paperbackup.py to backup keys as QR codes on paper
Peter Lebbing
peter at digitalbrains.com
Fri Feb 24 17:17:01 CET 2017
On 23/02/17 13:36, Gerd v. Egidy wrote:
> So I think that this would move the bar for a possible user of paperbackup.py
> higher than I want to.
Yes, it should be easy to use. In fact, I've sometimes heard the
complaint that "paperkey is not easy to install and/or use". That's
really too bad that those people feel that way.
> Ideally it is a tool or combination of tools already deployed widely, like sed
> and sort I used in paperrestore. This would make the checksums still usable
> even when the source to paperbackup.py isn't available anymore.
It took me some fiddling... but using CRC RevEng[1] I got a checksum in
Python that is compatible to POSIX cksum.
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'
generates the same checksums as the following Bash code:
$ printf $(printf '%08x' $(echo -n 123456789 | cksum | cut -d' ' -f1) | sed 's/../\\x\0/g')|base64|cut -b-4
N3pg
This is done with the attached Python code. It is written for
compactness rather than speed. Just re-implementing the crc function
would probably be quicker.
HTH,
Peter.
[1] <http://reveng.sourceforge.net/>
--
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: posixcksum.py
Type: text/x-python
Size: 3560 bytes
Desc: not available
URL: </pipermail/attachments/20170224/af53a553/attachment-0001.py>
-------------- 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/af53a553/attachment-0001.sig>
More information about the Gnupg-users
mailing list