Skip to content

Instantly share code, notes, and snippets.

@jakiki6
Last active May 25, 2024 23:05
Show Gist options
  • Save jakiki6/efaaa91b086e22f0f7dbbd045df6e1a3 to your computer and use it in GitHub Desktop.
Save jakiki6/efaaa91b086e22f0f7dbbd045df6e1a3 to your computer and use it in GitHub Desktop.
minisign seed
diff --color --recursive --text --unified a/src/minisign.c b/src/minisign.c
--- a/src/minisign.c 2024-05-26 01:03:18.372022776 +0200
+++ b/src/minisign.c 2024-05-26 01:03:45.448649920 +0200
@@ -676,10 +676,14 @@
PubkeyStruct *pubkey_struct = xsodium_malloc(sizeof(PubkeyStruct));
FILE *fp;
+ char *phrase = "test";
+ char *seed = xsodium_malloc(40);
+ crypto_generichash(seed, 40, phrase, strlen(phrase), NULL, 0);
+
abort_on_existing_key_files(pk_file, sk_file, force);
memset(seckey_struct, 0, sizeof(SeckeyStruct));
- randombytes_buf(seckey_struct->keynum_sk.keynum, sizeof seckey_struct->keynum_sk.keynum);
- crypto_sign_keypair(pubkey_struct->keynum_pk.pk, seckey_struct->keynum_sk.sk);
+ memcpy(seckey_struct->keynum_sk.keynum, seed + 32, 8);
+ crypto_sign_seed_keypair(pubkey_struct->keynum_pk.pk, seckey_struct->keynum_sk.sk, seed);
memcpy(seckey_struct->sig_alg, SIGALG, sizeof seckey_struct->sig_alg);
memcpy(seckey_struct->kdf_alg, unencrypted_key ? KDFNONE : KDFALG,
sizeof seckey_struct->kdf_alg);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment