aboutsummaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
Diffstat (limited to 'utils')
-rwxr-xr-xutils/last_gasp_default_pin8
1 files changed, 6 insertions, 2 deletions
diff --git a/utils/last_gasp_default_pin b/utils/last_gasp_default_pin
index 4dd1d54..1f340d0 100755
--- a/utils/last_gasp_default_pin
+++ b/utils/last_gasp_default_pin
@@ -66,6 +66,10 @@ args = parser.parse_args()
def HMAC_SHA256(pin, salt):
return HMAC.new(pin, salt, SHA256).digest()
+def uint8(value):
+ value = hexlify(value).decode("ascii")
+ return ", ".join("0x" + value[i : i + 2] for i in range(0, len(value), 2))
+
salt = urandom(16)
pin = PBKDF2(password = args.pin,
@@ -84,5 +88,5 @@ static const hal_ks_pin_t hal_last_gasp_pin = {{
{{{pin}}},
{{{salt}}}
}};'''.format(iterations = args.iterations,
- pin = ", ".join(hexlify(v) for v in pin),
- salt = ", ".join(hexlify(v) for v in salt)))
+ pin = uint8(pin),
+ salt = uint8(salt)))