1. Roland Smith
  2. PowerBuilder
  3. Thursday, 30 September 2021 15:33 PM UTC

The CrypterObject has a SHA function for creating a hash. Unfortunately the output is a blob.

How do I convert that to a string?

Accepted Answer
Armeen Mazda @Appeon Accepted Answer Pending Moderation
  1. Thursday, 30 September 2021 16:09 PM UTC
  2. PowerBuilder
  3. # Permalink
Blob lblb_data
Blob lblb_sha1
String ls_data

lblb_data = Blob("Test SHA1", EncodingANSI!)

CrypterObject lnv_CrypterObject
lnv_CrypterObject = Create CrypterObject

// Encrypt with SHA
lblb_sha1= lnv_CrypterObject.SHA(SHA1!, lblb_data)

Coderobject lnv_code
Lnv_code = create coderobject
//Encode the SHA blob data to be hex data and output as a string
Ls_data = lnv_code.hexencode(lblb_sha1)
Comment
  1. Roland Smith
  2. Thursday, 30 September 2021 16:52 PM UTC
Can you tell me which PB runtime DLL files CrypterObject and CoderObject require?
  1. Helpful
  1. Armeen Mazda @Appeon
  2. Thursday, 30 September 2021 16:57 PM UTC
pbcrypt.dll
  1. Helpful 1
There are no comments made yet.
mike S Accepted Answer Pending Moderation
  1. Thursday, 30 September 2021 16:10 PM UTC
  2. PowerBuilder
  3. # 1

lblb_hash = lcr_crypt.sha( SHA3_256! , lblb_valuetohash)
ls_hashstring = lcdr_coder.base64encode( lblb_hash )

Comment
There are no comments made yet.
Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Thursday, 30 September 2021 15:44 PM UTC
  2. PowerBuilder
  3. # 2

Hi Roland;

  Due to the binary nature of the encryption, have you thought about outputting this data stream as a Base64 string?

Regards ... Chris

Comment
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.