SB1 on Nostr: Yeah, all so early Here some helper.py gtp3 created u might find usefull just to ...
Yeah, all so early Here some helper.py gtp3 created u might find usefull just to test.
```
#!/bin/bash
# Read the file data
data=$(cat $filename)
# Serialize the list of Bech32-encoded public keys
serialized_names=""
for name in "${names[@]}"; do
# decode the Bech32 encoded pub keys
key_bytes=$(bech32 -d $name)
# Append the key to the serialized_names
serialized_names="$serialized_names$key_bytes"
done
# Concatenate the inputs and the serialized names with the file data
concatenated_data="$A$data$serialized_names"
# Calculate the SHA-256 hash of the file data
data_hash=$(echo -n "$data" | openssl dgst -sha256 -hex)
# Calculate the SHA-256 hash of the concatenated data
final_hash=$(echo -n "$concatenated_data" | openssl dgst -sha256 -hex)
# Compare the final hash with the Result
if [ "$final_hash" = "$Result" ]; then
proof=true
else
proof=false
fi
# Calculate the n-times hashed final hash
n_times_hashed=$final_hash
for ((i=0;i<n;i++)); do
n_times_hashed=$(echo -n "$n_times_hashed" | openssl dgst -sha256 -hex)
done
# Output the hashes
echo "Data Hash: $data_hash"
echo "Final Hash: $final_hash"
echo "Proof: $proof"
echo "$n times hashed final hash: $n_times_hashed"
```
Published at
2023-01-18 15:54:32Event JSON
{
"id": "ec6127115e6363f0cec9e7426708a978ae08af5c7ab9dc0cbcb1da1bce02c2ff",
"pubkey": "1ce88359c56de5a35cea9413d1b98bc8ed3e8362c02469beab6064fd8d6e8eae",
"created_at": 1674057272,
"kind": 1,
"tags": [
[
"e",
"8d4c95d7257d03c2680d21e5bf546b357dc4518eb6a35f9f4eed40da134fadb0",
"wss://nostr.ono.re",
"reply"
],
[
"p",
"d7536260b88cf7e5cc3fca4f82240f342bc098762cf3b855d5d765e78c95ddcb"
],
[
"p",
"eb362a4ad5c55e5ff02ceda83eaab5dbf4e8be07abec25615bb2e3ebbff7bd61",
"wss://relay.nostr.info"
],
[
"p",
"eb362a4ad5c55e5ff02ceda83eaab5dbf4e8be07abec25615bb2e3ebbff7bd61",
"wss://relay.nostr.info"
],
[
"p",
"1ce88359c56de5a35cea9413d1b98bc8ed3e8362c02469beab6064fd8d6e8eae",
"wss://nostr-pub.wellorder.net"
]
],
"content": "Yeah, all so early Here some helper.py gtp3 created u might find usefull just to test.\n```\n#!/bin/bash\n\n# Read the file data\ndata=$(cat $filename)\n\n# Serialize the list of Bech32-encoded public keys\nserialized_names=\"\"\nfor name in \"${names[@]}\"; do\n # decode the Bech32 encoded pub keys\n key_bytes=$(bech32 -d $name)\n # Append the key to the serialized_names\n serialized_names=\"$serialized_names$key_bytes\"\ndone\n\n# Concatenate the inputs and the serialized names with the file data\nconcatenated_data=\"$A$data$serialized_names\"\n\n# Calculate the SHA-256 hash of the file data\ndata_hash=$(echo -n \"$data\" | openssl dgst -sha256 -hex)\n\n# Calculate the SHA-256 hash of the concatenated data\nfinal_hash=$(echo -n \"$concatenated_data\" | openssl dgst -sha256 -hex)\n\n# Compare the final hash with the Result\nif [ \"$final_hash\" = \"$Result\" ]; then\n proof=true\nelse\n proof=false\nfi\n\n# Calculate the n-times hashed final hash\nn_times_hashed=$final_hash\nfor ((i=0;i\u003cn;i++)); do\n n_times_hashed=$(echo -n \"$n_times_hashed\" | openssl dgst -sha256 -hex)\ndone\n\n# Output the hashes\necho \"Data Hash: $data_hash\"\necho \"Final Hash: $final_hash\"\necho \"Proof: $proof\"\necho \"$n times hashed final hash: $n_times_hashed\"\n\n```\n",
"sig": "bb209a2904828649fc4e143b040ea092fd1096d5f120b091b2b6329873d2ca5344aaf7e7a56aa5dee8826632e3df7c7872b395094298e0dd1f16db57417de231"
}