Hi
"I need to encrypt some information, mostly 13 charatcter strings through Sha_256 algorithm supplying its public key."
What you are asking for cannot be done; they are two types of encryption for different needs.
Harbour has SHA, but it does not have RSA, which is the standard for asymmetric encryption.
These are the SHA algorithm functions that Harbour has:
PROCEDURE Main()
? "hb_SHA1"
? hb_SHA1("The world is unique and colorful")
?
? "hb_SHA224"
? hb_SHA224("The world is unique and colorful")
?
? "hb_SHA256"
? hb_SHA256("The world is unique and colorful")
?
? "hb_SHA384"
? hb_SHA384("The world is unique and colorful")
?
? "hb_SHA512"
? hb_SHA512("The world is unique and colorful")
?
wait
RETURN
Output:
hb_SHA1
9990a8e1901bc063cdabac5f6307dd32ecf5b1ec
hb_SHA224
29e549fa1d3fff8dd7d2a11866b648f62d81f9ae6bb9349ef6f7a344
hb_SHA256
fec0ed8762f3cad9b2206cc8befad0b1d9002b48191c2f929e7461ae711d52a5
hb_SHA384
4761b630c1e128fabf30a9675624a13439d8cb1174b12c3fa9b583101d833a2ea81753501e57370f990a75febb7cc148
hb_SHA512
6e75d9444dbe323bf618482ff2a0fec255143b649d3930b3dc87f0dd00aa90bc937e8dfe1a131d21290cf255639ee8867433ab70c69023ffc7afb137fe71432a
Press any key to continue...
hb_SHA1(<cBuffer> [, <lBin>]) ➜ cDigest
hb_SHA224(<cBuffer> [, <lBin>]) ➜ cDigest
hb_SHA256(<cBuffer> [, <lBin>]) ➜ cDigest
hb_SHA384(<cBuffer> [, <lBin>]) ➜ cDigest
hb_SHA512(<cBuffer> [, <lBin>]) ➜ cDigest
Above functions are used to calculate hash value (digest) of given <cBuffer> according to SHA-1, SHA-2, SHA-3 Secure Hash Algorithms.
<lBin> flag controls whether to return binary data or hexadecimal string, default .F., that is, return hexadecimal string.
https://en.wikipedia.org/wiki/Secure_Hash_Algorithmshttps://www.cohesity.com/glossary/rsa-encryption/The RSA algorithm would have to be implemented in C so that Harbour can handle public and private keys.
Sincerely,
Marcos Jarrin