[Pgp-tools-commit] r639 - in trunk/keyart: . doc
Aaron Toponce
atoponce-guest at moszumanska.debian.org
Thu Jun 12 12:20:33 UTC 2014
Author: atoponce-guest
Date: 2014-06-12 12:20:33 +0000 (Thu, 12 Jun 2014)
New Revision: 639
Modified:
trunk/keyart/README
trunk/keyart/doc/druken-bishop.txt
trunk/keyart/keyart
Log:
Change algorithm, add multiple key support
The algorithm now supports the OpenSSH algorithm, where 2-bit pairs are
read in little endian, rather than reading the whole string in big endian.
As a result, documentation is updated to reflect this.
The script now accepts multiple files, but passing -i|--id is required, as
future support for -k|--keyring will be needed as an alternative.
Modified: trunk/keyart/README
===================================================================
--- trunk/keyart/README 2014-06-11 16:47:20 UTC (rev 638)
+++ trunk/keyart/README 2014-06-12 12:20:33 UTC (rev 639)
@@ -14,15 +14,15 @@
$ keyart 0x8086060F
+----[DSA 1024]-----+
- |l^ . ^^?^. |
- |l. . .l:.? |
- |^ E ...ll |
- |^. . ^:. |
- |^ . . .. |
- | . . . S |
- | . . . . |
- | . . |
+ |E . . ^^i. |
+ |:l. . i.^i:. |
+ |^^.. :.^: : |
+ |: ^ .l |
+ |.. . . : |
+ | . S |
| |
| |
| |
+ | |
+ | |
+----[8086060F]-----+
Modified: trunk/keyart/doc/druken-bishop.txt
===================================================================
--- trunk/keyart/doc/druken-bishop.txt 2014-06-11 16:47:20 UTC (rev 638)
+++ trunk/keyart/doc/druken-bishop.txt 2014-06-12 12:20:33 UTC (rev 639)
@@ -62,7 +62,8 @@
1000000010000110 0000011000001111
In OpenSSH, the movement is found using bit-pairs at a time, left to
-right, least significant bit to most sifginifant bit. So:
+right, least significant bit to most sifginifant bit. In this
+implementation for OpenPGP, the same rule applies. So:
+-----+-----++-----+-----++-----++-----+-----++-----+-----+
Fingerprint: | E | 0 || 4 | 1 || ... || 0 | 6 || 0 | F |
@@ -72,12 +73,6 @@
Step: |4 |3 |2 |1 ||8 |7 |6 |5 || ... ||76|75|74|73||80|79|78|77|
+--+--+--+--++--+--+--+--++-----++--+--+--+--++--+--+--+--+
-For this GnuPG implementation, rather than following OpenSSH and read the
-bits with little endian, I've decided to read the bits in big endian
-(left to right the full way). This greatly simplifies the code, and I
-don't see any advantage to reading the bits with little endian, as the
-SHA1 output should be random anyway.
-
The direction of our drunken bishop follows standard Chess rules for the
bishop piece, moving only on the diagnal across the beard, which is
defined as follows:
Modified: trunk/keyart/keyart
===================================================================
--- trunk/keyart/keyart 2014-06-11 16:47:20 UTC (rev 638)
+++ trunk/keyart/keyart 2014-06-12 12:20:33 UTC (rev 639)
@@ -7,9 +7,11 @@
import sys
parser = argparse.ArgumentParser(description='Create an ASCII art of a PGP key.')
-parser.add_argument('-a','--ansi', help='Print the art with ANSI color.',
- action='store_true')
-parser.add_argument('keyid')
+group = parser.add_mutually_exclusive_group(required=True)
+parser.add_argument('-a','--ansi', help='Print the art with ANSI color.', action='store_true')
+group.add_argument('-i', '--id', action='store_false', help='A key identifier.')
+#group.add_argument('-k', '--keyring', action='store_true', help='A GPG keyring.')
+parser.add_argument('KEYID', nargs='+')
args = parser.parse_args()
def draw_art(key):
@@ -20,8 +22,7 @@
gpg_bin = '/usr/bin/gpg2'
DEVNULL = open(os.devnull, 'wb')
- gpg = subprocess.Popen(('gpg', '--fingerprint', '--with-colons',
- key),stdout=subprocess.PIPE, stderr=DEVNULL)
+ gpg = subprocess.Popen(('gpg', '--fingerprint', '--with-colons', key),stdout=subprocess.PIPE, stderr=DEVNULL)
out = gpg.communicate()
DEVNULL.close()
except OSError:
@@ -51,6 +52,13 @@
f_bytes.append(temp)
temp = ''
+ for i,c in enumerate(f_bytes):
+ if i % 4 == 0:
+ f_bytes[i],f_bytes[i+3] = f_bytes[i+3],f_bytes[i]
+ if i % 4 == 1:
+ f_bytes[i],f_bytes[i+1] = f_bytes[i+1],f_bytes[i]
+ i += 2
+
for d in f_bytes:
if (20 <= pos <= 36 or 39 <= pos <= 55 or 58 <= pos <= 74 or
77 <= pos <= 93 or 96 <= pos <= 112 or 115 <= pos <= 131 or
@@ -197,5 +205,6 @@
return '{}{}{}'.format(color, coin, reset)
if __name__ == '__main__':
- key = args.keyid
- print draw_art(key)
+ if args.KEYID:
+ for key in args.KEYID:
+ print draw_art(key)
More information about the Pgp-tools-commit
mailing list