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"
```
```
#!/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"
```