From 463a45c1791201a8f99da62468f13532ff433d7f Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Sat, 21 Dec 2013 10:14:54 -0800 Subject: [PATCH] Add hashlib hash names to PGPPacket._hashlib_name The string-to-key algorithm is going to use hashlib for hashing, so map the OpenPGP-based names to hashlib names for easy lookup. --- gpg-migrate.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/gpg-migrate.py b/gpg-migrate.py index 844e21c..393d460 100755 --- a/gpg-migrate.py +++ b/gpg-migrate.py @@ -173,6 +173,16 @@ class PGPPacket (dict): 110: 'private', } + _hashlib_name = { # map OpenPGP-based names to hashlib names + 'md5': 'md5', + 'sha-1': 'sha1', + 'ripe-md/160': 'ripemd160', + 'sha256': 'sha256', + 'sha384': 'sha384', + 'sha512': 'sha512', + 'sha224': 'sha224', + } + _string_to_key_types = { 0: 'simple', 1: 'salted', -- 2.26.2