Add PGPPacket._hash_algorithms
authorW. Trevor King <wking@tremily.us>
Fri, 20 Dec 2013 05:18:01 +0000 (21:18 -0800)
committerW. Trevor King <wking@tremily.us>
Fri, 20 Dec 2013 18:56:23 +0000 (10:56 -0800)
From RFC 4880 [1]:

      ID           Algorithm                             Text Name
      --           ---------                             ---------
      1          - MD5 [HAC]                             "MD5"
      2          - SHA-1 [FIPS180]                       "SHA1"
      3          - RIPE-MD/160 [HAC]                     "RIPEMD160"
      4          - Reserved
      5          - Reserved
      6          - Reserved
      7          - Reserved
      8          - SHA256 [FIPS180]                      "SHA256"
      9          - SHA384 [FIPS180]                      "SHA384"
      10         - SHA512 [FIPS180]                      "SHA512"
      11         - SHA224 [FIPS180]                      "SHA224"
      100 to 110 - Private/Experimental algorithm

[1]: http://tools.ietf.org/search/rfc4880#section-9.4

gpg-migrate.py

index 401b69601a4f725fc7ac753356e54e18ddbbdb4d..e75cab84803dfd9c8866871246c16ea5e33d6531 100755 (executable)
@@ -117,6 +117,31 @@ class PGPPacket (dict):
         110: 'private',
         }
 
+    _hash_algorithms = {
+        1: 'md5',
+        2: 'sha-1',
+        3: 'ripe-md/160',
+        4: 'reserved',
+        5: 'reserved',
+        6: 'reserved',
+        7: 'reserved',
+        8: 'sha256',
+        9: 'sha384',
+        10: 'sha512',
+        11: 'sha224',
+        100: 'private',
+        101: 'private',
+        102: 'private',
+        103: 'private',
+        104: 'private',
+        105: 'private',
+        106: 'private',
+        107: 'private',
+        108: 'private',
+        109: 'private',
+        110: 'private',
+        }
+
     _clean_type_regex = _re.compile('\W+')
 
     def _clean_type(self):