kruyoupatel
8th September 2015, 19:29
Hello Guys,

Can any one share his knowledge for performing SHA-256 encryption in baan4c4.

Actually my requirement is to perform SHA-256 encode , which further is converted as base 64 string.

Is there any function which can be used to have SHA-256(Base 64) encode or can we use any utility to get it perform.

NOTE: (utility should be accessible from AIX(IBM) Platform)

Regards,
KP

bhushanchanda
8th September 2015, 20:42
Hi,

For TIV higher or equal to 2000, there are inbuilt digest.* functions to do it. Other than that, you can create your own utility in any programming language to do the job for you.

Here's one in Python

import hashlib
import random

msg = 'Bhushan'
new_msg = hashlib.sha256(msg.encode('utf-8')).hexdigest()
print(new_msg)

This gives the output -

f1c1b35064be0e8106303eee0ae9015512aa93a5198a1ee210e2ea77dc233aaf

This link (http://unix.stackexchange.com/questions/3675/how-can-i-get-a-base64-encoded-shax-on-the-cli) shows some more ways.

There's also OpenSSL command line utility which does the job. Either of the solution will work. Else, you can wait for a person who has done this in AIX.

sam291091
9th September 2015, 12:40
Hi bhushanchanda,

This is example of encryption but how to do decryption for same any example you have for decryption.

bhushanchanda
9th September 2015, 12:50
Hi,

SHA256 is Cryptographic(one way) hash (https://en.wikipedia.org/wiki/Cryptographic_hash_function). There is no direct way to decode it. The other ways is by guessing which we call Brute-Force.

The short answer is you cannot 'decrypt' a hash; it is a one way function. There is a major difference between encrypting and hashing.

Hashing

See http://en.wikipedia.org/wiki/Cryptographic_hash_function

Note: It is possible to 'BREAK' certain hashing algorithms, but this is not decrypting. You'll find more information in the links as well as other algorithms that are also supported by python

Encryption

and http://en.wikipedia.org/wiki/Encryption

Example

A useful example of hashing is storing passwords in a database whereas a useful example of encryption is sending your bank details to an online store to purchase something.

vahdani
9th September 2015, 12:53
Hi,

there are indeed built in functions you can use!

Take a look at these Baan built in functions: base64.encode() (http://www.baanboard.com/programmers_manual_baanerp_help_functions_base64_base64_encode) and base.64.decode() (http://www.baanboard.com/programmers_manual_baanerp_help_functions_base64_base64_decode).

For latest Information you can take a look at the latest Infor Programmers Guide.