Articles in this section

How to convert EDIGEST base64 to DIGEST ?

Context

Aerospike Backup tool (asbackup) currently stores the DIGEST of a record as a base64 EDIGEST, Aerospike logs contain hex format DIGEST's.
At times it may be necessary to convert from the EDIGEST to the hex DIGEST. 

Method

The conversion can be done in python or bash :-
 
python2 -c 'print "<EDIGEST>".decode("base64").encode("hex")'
python3 -c 'from base64 import b64encode, b64decode;edigest="<EDIGEST>";print(b64decode(edigest.encode()).hex())'
Or
echo '<EDIGEST>'| base64 -d | xxd -ps
Example :-

+ n test
+ d 2y/e0c0/HfSWDv1uu+k4HMQKNnM=
+ s myset
+ g 1
+ t 0
+ b 1
- S mybin 7 bin_250

# python2 -c 'print "2y/e0c0/HfSWDv1uu+k4HMQKNnM=".decode("base64").encode("hex")'
db2fded1cd3f1df4960efd6ebbe9381cc40a3673

# python3 -c 'from base64 import b64encode, b64decode;edigest="2y/e0c0/HfSWDv1uu+k4HMQKNnM=";print(b64decode(edigest.encode()).hex())'
db2fded1cd3f1df4960efd6ebbe9381cc40a3673

# echo '2y/e0c0/HfSWDv1uu+k4HMQKNnM='| base64 -d | xxd -ps
db2fded1cd3f1df4960efd6ebbe9381cc40a3673

This matches the digest we have in our logs :-

Mar 08 2024 10:31:11 GMT: DETAIL (rw-client): (thr_tsvc.c:99) {test} digest db2fded1cd3f1df4960efd6ebbe9381cc40a3673 client [::1]:35108 read

Applies To Earliest Version

Pre 4.9

Applies To Latest Version

Current Version
Was this article helpful?
0 out of 0 found this helpful