I'm trying to mimic is this PHP functionality
<?php base64_encode( hash_hmac( 'SHA256', $a, $b, true) );?>
is there a difference between the "HmacSHA256" and "sha256"?
This works - but doesn't give me the same result:
<cfscript> toBase64( hmac( a, b, 'HmacSHA256', 'us-ascii' ) );</cfscript>
this tells me "sha256" is unavail (because Im not using enterprise)
<cfscript> toBase64( hmac( a, b, 'SHA256', 'us-ascii' ) );</cfscript>
Any way I can do this without enterprise? isn't there a java lib i can tie into for encoding?
I am getting two different hash values when line breaks are added.
When I run a hash on "onetwo" I get:
When I use PHP
echo hash('sha256', 'onetwo');
But when I run a hash from the URL that includes a line break (return) like:
But when I use PHP I get:
Can any one point out why this is so? Why does adding line breaks give different results?
Here is my PHP/HTML code as you will see I am using a form and submitting the data to be hashed.
<!DOCTYPE HTML><html> <head> <title>Sha256 Hash</title> </head> <body> <div style="float: left;"> Start here and insert text below to be hashed.<br /> <form name="submit hash" action="" method="POST"> <textarea name="text" style="border: thin solid #000; width: 500px; padding: 10px; height: 500px;"><? if($_SERVER['REQUEST_METHOD'] == 'POST') echo $_POST['text']; ?></textarea> <br style="clear: both;" /> <input type="submit" name="submit" value="submit" /> </form> </div> <? if($_SERVER['REQUEST_METHOD'] == 'POST'): ?> <div style="border: thin solid #000; margin: 10px; padding: 10px; float: left;"> <br />sha256: <b><?= hash('sha256',$_POST['text']); ?></b><br /> </div> <? endif; ?> </body></html>
My client is sending me a SHA-256 encrypted string. And also it is having a salt. Myself and my client both are knowing the above salt. I need to check weather the string is having correct salt or not.
I am trying to find something potentially faster then SHA256. I have over 1 billion records I need to hash and verify if they are unique. I am currently running it through an MD5 which seems pretty fast then through the sha256 to avoid collisions. Running them in that order seems to give me a little performance boost but I still need it faster. I am looking for the names or examples of some hashes done in c# or some pseudo-code so I can recreate it in c#.
Due to windows changing their security policies, we are planning to begin code-signing driver files with the SHA-256 algorithm instead of SHA-1. However, we still want to be able to support older OS's that still require SHA-1 signing.
Using Microsoft's signtool.exe we are able to code sign files successfully with both SHA-1 and SHA-256 digest algorithms using the /fd flag. However, if possible, we would like to sign the file with both algorithms simultaneously. Is this even possible? We would like to avoid having multiple sets of drivers that are signed with different algorithms and determining which set to install based on OS -- which would be our alternative approach.
If anyone has had experience with accomplishing this please explain what approach you took. If this isn't possible, an explanation of why it's impossible would be appreciated. Thanks!