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. Armeen Mazda @Appeon
  2. Thursday, 30 September 2021 16:57 PM UTC
pbcrypt.dll
  1. Helpful 1
  1. Francisco Rico
  2. Thursday, 1 December 2022 19:35 PM UTC
How can i start to use Cryper Object in my project..??

Add as a reference?

Library?

Sorry for my poor knowledge...!!
  1. Helpful
  1. Armeen Mazda @Appeon
  2. Thursday, 1 December 2022 19:44 PM UTC
Upgrade to PB 2017 R3 or newer… it is a system object: https://docs.appeon.com/pb2017r3/whats_new/ch01s04.html
  1. Helpful
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.
We use cookies which are necessary for the proper functioning of our websites. We also use cookies to analyze our traffic, improve your experience and provide social media features. If you continue to use this site, you consent to our use of cookies.