Hello,

I'm trying to get Unidata's DIGEST function (using SHA1) to match the
output of a Java program using the same algorithm.

In the Unidata Commands Reference it states that the output of DIGEST
can be either binary or hex.  It doesn't tell you how to specify which
one you want.

The line:
"The result can be in either binary or hex format."
has got me scratching my head.

Does this mean that the return could randomly be either hex or binary?
Is this something that needs to be configured in Unidata?

Any pointers are appreciated.

Thanks
-Ben







>From Unidata Commands Reference:

DIGEST
Syntax
DIGEST(algorithm, data, dataLoc, result)
Description
The DIGEST function generates a message digest of supplied data. 
A message digest is the result of a one-way hash function (digest
algorithm) performed on the message. Message digest has the unique
properties that alight change in the input results in a significant
difference in the resulting digest. Therefore, the probability of two
different messages resulting in the same digest (collision) is very
unlikely. It is also virtually impossible to reverse to the original
message from a digest. Message digest is widely used for digital
signatures and other purposes.
The desired digest algorithm is specified in algorithm. UniData supports
the MD5 (Message Digest 5, 128-bit) and SHA1 (Secure Hash Algorithm 1,
160-bit) algorithms. You specify data and its location are with data and
dataLoc, respectively. UniData puts the arrived digest into a dynamic
array in result. Since digest is short and has a fixed length, it is
always put into a string, and no file option is provided. 
The result can be in either binary or hex format. <-------------<<<<

Parameters
The following table describes each parameter of the syntax.

Parameter  Description
algorithm  A string containing the digest algorithm name (either “MD5” or 
“SHA1”).


The following table describes the status of each return code.
data
Data or the name of the file containing the data to be digested.
dataLoc
1 - Data in a string
2 - Data in a file
result
A string to store the digest result.
Return Code    Status
0              Success
1              Unsupported digest algorithm
2              The data file cannot be read
3              Message digest cannot be obtained
4              Invalid parameters


- 


_______________________________________________
U2-Users mailing list
[email protected]
http://listserver.u2ug.org/mailman/listinfo/u2-users

Reply via email to