sha256

Is my OCaml implementation of SHA256 sane?

I'm a novice OCaml programmer and thought I would throw myself into the deep end by attempting to implement a very tricky algorithm. I'm open to all criticisms great and small be they stylistic or security or performance related. One criticism that I'm already aware of is that the algorithm requires the entire message to fit in memor...

The correct way to encrypt a string using HmacSHA256 in VB.NET

Hello, I need to create a keyed hash for a string of XML to send to a 3rd party. This is the code I am using but it is producing a different hash then the example the 3rd party has sent me. I have been through all the tutorials I can find and re-read MSDN again and again, what am I doing wrong? Or should I suspect a problem at the other...

Difference in SHA hashes between ruby and C#

I'm developing an application, that makes use of some REST web services. It's technical documentation says that I should pass SHA256 hash of some string in the request. In an example request (in the documentation) a string: hn-Rw2ZHYwllUYkklL5Zo_7lWJVkrbShZPb5CD1expires=1893013926label[0]=any/somestatistics=1d,2d,7d,28d,30d,31d,life...

Fastest path to Lua SHA256 RFC-2104 compliant HMAC signature?

I'm running Debian Linux, and for a Lua script I need to create a SHA256 checksum to authenticate requests to Amazon Web Services. They don't say for sure but it looks as if they may want a base64 encoding of the resulting SHA256 checksum. I'd be happy if someone had done a Lua binding. I'd be content if someone could help me figure o...

SHA256CryptoServiceProvider and related possible to use on WinXP?

Is it possible to use SHA256CryptoServiceProvider and related SHA2 providers on Windows XP? I know the providers use the cryptography services that are included in Vista and above is it possible to install these services in XP from Microsoft? EDIT: I should've provided more information the documentation on the MSDN is wrong in regards t...

Calculating a SHA hash with a string + secret key in python

Amazon Product API now requires a signature with every request which I'm trying to generate ushing Python. The step I get hung up on is this one: "Calculate an RFC 2104-compliant HMAC with the SHA256 hash algorithm using the string above with our "dummy" Secret Access Key: 1234567890. For more information about this step, see documenta...

What is wrong with this "StretchKey" implementation?

I'm trying to create a Delphi version of this algorithm: void PWSfileV3::StretchKey(const unsigned char *salt, unsigned long saltLen, const StringX &passkey, unsigned int N, unsigned char *Ptag) { /* * P' is the "stretched key" of the user's passphrase and the SALT, as defined ...

SHA256 hash in Python 2.4

Hi, Is there a way I can calculate a SHA256 hash in Python 2.4 ? (I emphasize: Python 2.4) I know how to do it in Python 2.5 but unfortunately it's not available on my server and an upgrade will not be made. I have the same problem as the guy in this question, but using Python 2.4. Any help will be greatly appreciated. EDIT: Sorry, I me...

Is it safe to use PBKDF2 with SHA256 to generate 128-bit AES keys?

I want to use PBKDF2 with some cryptographic hash function to generate 128-bit AES keys. SHA1 is also 128-bit, so I thought of using that with PBKDF2, but it was broken, so I have opted to use SHA256 instead. Is this safe, or will the difference between the hash size and resulting key size cause some sort of disastrous silent truncation ...

SHA256 For Ruby Not Working On Mac

On my mac 10.5 when I use the command OpenSSL::Digest::Digest.new('sha256') I get Unsupported digest algorithm (sha256). Does anyone know how to solve this? ...

MySQL on Windows: Using SHA-2

Hello guys, I need to store sensitive data (usernames and passwords) and wanted to do things the right way (storing SHA-256 hashes of (password).(large random number) instead of cleartext passwords. This needs to be done using MySQL and, as far as i know, only MySQL 6 plans to incorporate SHA-2, hence i assume some kind of external appl...

Java: Calculate SHA-256 hash of large file efficiently

I need to calculate a SHA-256 hash of large file (or portion of it). My implementation works fine, but its much slower than the C++'s CryptoPP calculation (25 Min. vs. 10 Min for ~30GB file). What I need is a similar execution time in C++ and Java, so the hashes are ready at almoust the same time. I also tryed the Bouncy Castle implement...

How to use sha256 in php5.3.0

Hello, I'm using sha256 to encrypt the password. I can save the sha256 encrypted password in mysql. But i can't login with the same clause. Insert code: <?php error_reporting(E_ALL ^ E_NOTICE); $username = $_POST['uusername']; $passcode = $_POST['ppasscode']; $userflag = $_POST['uuserflag']; //$passcodeen = hash('sha256',$passcode); $...

(PHP) SHA1 vs md5 vs SHA256: which to use for a PHP login?

I'm making a php login, and I'm trying to decide whether to use SHA1 or Md5, or SHA256 which I read about in another stackoverflow article. Are any of them more secure than others? For SHA1/256, do I still use a salt? Also, is this a secure way to store the password as a hash in mysql? function createSalt() { $string = md5(uniqid(...

(PHP) When using a SHA256 hash, how long is the hash? (ie, how long should my mysql VARCHAR be?)

I'm going to run SHA256 on a password + salt, but I don't know how long to make my VARCHAR when setting up the mysql database. What is a good length? ...

generate sha256 with openssl and C++

Hello, I'm looking to create a hash with sha256 using openssl and C++. I know there's a similar post about this here: http://stackoverflow.com/questions/918676/generate-sha-hash-in-openssl, but I'm looking to specifically create sha256. UPDATE: Seems to be a problem witht he include paths. It can't find any openssl functions even...

Are there circumstances where a hash algorithm can be guaranteed unique?

If I'm hashing size-constrained similar data (social security numbers, for example) using a hash algorithm with a larger byte size than the data (sha-256, for example), will the hash guarantee the same level of uniqueness as the original data? ...

encrypt- decrypt with SHA256 using C/C++

Hi! How can I encode a file using sha256 and c/c++ ??? Thanks! ...

Unable to verify body hash for DKIM

I'm writing a C# DKIM validator and have come across a problem that I cannot solve. Right now I am working on calculating the body hash, as described in Section 3.7 Computing the Message Hashes. I am working with emails that I have dumped using a modified version of EdgeTransportAsyncLogging sample in the Exchange 2010 Transport Agent SD...

How to generate RSA-SHA256 digital signature with OpenSSL libraries?

Hi, I need to generate a digital signature from C++ code, using OpenSSL libraries. I understood that I need for that DSA \ DSA_do_sign, but didn't understand how exactly to use it. Does someone have an example for that, or a reference for better than OpenSSL's supplied docs? Thanks in advance! ...