1. mike S
  2. PowerBuilder
  3. Monday, 23 October 2023 14:43 PM UTC

Apparently PB is WAY ahead of .net and implemented SHA3 before .net did.  It is supposed to be in .net 8, which is as of today on RC2.

 

Looking up a few things, it appears that the SHA3 standard can have 2 different implementations that generate 2 different values. Keccak vs FIPS-202 

sha 3 - How to generate SHA3-256 in .NET Core? - Stack Overflow

 

  • What does PB use?  Fips or Keccak?
  • has anyone else had to verify a SHA3 hash in .net that was generated in PB?
  • any ideas?

 

Accepted Answer
mike S Accepted Answer Pending Moderation
  1. Monday, 23 October 2023 18:44 PM UTC
  2. PowerBuilder
  3. # Permalink

following produces the same hash value in powerbuilder and .net:

//Powerbuilder Hash: 

blob lblb_hash
string stringtohash, HashBase64

lblb_hash = lcr_crypt.sha( SHA3_256! , stringtohash )
HashBase64 = lcdr_coder.base64encode( lblb_hash )

 

____________________________________________________

//.net 6.0 Hash:

//GitHub - dariogriffo/sha3.net: C# port of Keccak, known as SHA3


using SHA3.Net;  //download via nuget SHA3.net  (there is a version that does not have .net in the name that is NOT the one i downloaded)


string HashBase64;
using (var shaAlg = Sha3.Sha3256())
{
var hash = shaAlg.ComputeHash(Encoding.UTF8.GetBytes(stringtohash));
HashBase64 = System.Convert.ToBase64String(hash);
}

Comment
  1. Francisco Martinez @Appeon
  2. Monday, 23 October 2023 19:29 PM UTC
In Summary: PB's implementation of SHA3_256 follows the Keccak algorithm. Thanks for figuring that out, Mike!
  1. Helpful 2
There are no comments made yet.
Francisco Martinez @Appeon Accepted Answer Pending Moderation
  1. Monday, 23 October 2023 15:33 PM UTC
  2. PowerBuilder
  3. # 1

Hi Mike,

According to this StackOverflow post there's two ways of using SHA3-256 in .NET 6 right now, each one implementing one of the standards.
I think you can use these two implementations to figure out which one PB is using by seeing which one generates the same hash for a given input.

Regards,
Francisco

Comment
  1. mike S
  2. Monday, 23 October 2023 15:39 PM UTC
you don't know which 'standard' PB uses?
  1. Helpful
  1. Francisco Martinez @Appeon
  2. Monday, 23 October 2023 15:45 PM UTC
I'm not involved in PB's development, so all I could do is ask the development team. But by the time they answer I might as well find out myself by testing both standards in C# and then check which one matches PB's
  1. Helpful
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.