From 9feb2a8b377205ff8ab0f947ee511ec1fde5b9e7 Mon Sep 17 00:00:00 2001 From: tv Date: Sun, 3 Jan 2021 15:27:06 +0100 Subject: crxid: initial commit Based on https://github.com/dsoprea/ChromeIdGenerator/blob/master/README.txt --- crxid | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100755 crxid diff --git a/crxid b/crxid new file mode 100755 index 0000000..7c0236c --- /dev/null +++ b/crxid @@ -0,0 +1,23 @@ +#! /bin/sh +# Get CRX id from RSA key +# usage: crxid PEM_FILE + +set -efu + +pem_path=$1 + +digest=$( + openssl rsa -in "$pem_path" -pubout -outform der 2>/dev/null | + openssl dgst -sha256 -hex | + sed 's/^(stdin)= //;s/.*/\U&/' +) + +script=" + obase=16; + ibase=16; + ascii_a=61; + $(echo $digest | cut -b-32 | sed 's/./ascii_a + &;/g') +" + +echo "$script" | bc | xxd -r -p +echo -- cgit v1.2.3