sha256

SHA256 in T-sql stored procedure

Is it possible to generate a SHA-256 hash of a string from a stored procedure in Sql Server 2008? For deployment reasons, I'd prefer it in TSQL. ...

Are SHA-1, SHA-2 patented?

Do you need a license to use SHA-1 or SHA-2 for commercial purposes? ...

Is it okay to truncate a SHA256 hash to 128 bits?

MD5 and SHA-1 hashes have weaknesses against collision attacks. SHA256 does not but it outputs 256 bits. Can I safely take the first or last 128 bits and use that as the hash? I know it will be weaker (because it has less bits) but otherwise will it work? Basically I want to use this to uniquely identify files in a file system that migh...

Will a SHA256 hash always have 64 characters?

I'm setting up my database to receive hashed passwords and not accept plain text. Would I go something like this? create table User( username varchar(20) not null, password varchar(64) not null, ); ...

Windows C SHA256 Invalid Generation Issue

Hey there. I'm having a very strange problem with creating sha256 hashes. I made a simple C console program that takes a file path as an argument and uses the standalone sha256 code that can be found here. I compiled the program using MinGW 5.1.6 on Windows 7 x64. When testing the program on a file, the resultant hash is wrong. I made s...

Hash String via SHA-256 in Java

By looking around here as well as the internet in general, I have found Bouncy Castle. I want to use Bouncy Castle (or some other freely available utility) to generate a SHA-256 Hash of a String in Java. Looking at their documentation I can't seem to find any good examples of what I want to do. Can anybody here help me out? ...

Issues with Python hashlib.sha256 (2.4.3)

So I have some code: signature = hmac.new( key=AWS_SECRET_ACCESS_KEY, msg=string_to_sign, digestmod=hashlib.sha256).digest() That runs perfectly on my own computer (has python 2.6.1). However, when I run this code on my server (Python 2.4.3) I get the following: /home/MYUSERNAME/public_html/Foo.com/cgi-bin/foo.py 66 ...

Why is ComputeHash not acting deterministicly?

I've run into an interesting issue.. It seems that ComputeHash() for a "HMACSHA256" hash is not behaving deterministicly.. if I create two instances of HashAlgorithm using HashAlgorithm.Create("HMACSHA256").. And run ComputeHash, I get two different results.. below is an example static class that exhibiting this behavior. internal s...

Generating a sha256 from the Linux command line

I know the string "foobar" generates the SHA 256 hash c3ab8ff13720e8ad9047dd39466b3c8974e592c2fa383d4a3960714caef0c4f2 using http://hash.online-convert.com/sha256-generator However the command line shell: hendry@x201 ~$ echo foobar | sha256sum aec070645fe53ee3b3763059376134f058cc337247c978add178b6ccdfb0019f - Generates a different ...

Glassfish Security - jdbcRealm: How to configure login with SHA-256 digest

I use jdbcRealm for security in my glassfish v3.0.1 b22. It is set up so that it use the USER table inside my database for authentication by following this blog: http://blogs.sun.com/foo/entry/mort_learns_jdbc_realm_authentication. I got it working fine, if I leave the digest algorithm as plain text. However when i try to use SHA-256 for...

Problem with hash256 in Objective C

Hi,when i use this code for generate an hash256 in my iPhone app: unsigned char hashedChars[32]; NSString *inputString; inputString = [NSString stringWithFormat:@"hello"]; CC_SHA256([inputString UTF8String], [inputString lengthOfBytesUsingEncoding:NSASCIIStringEncoding ], hashedChars); NSData * hashedData = [NSData...

Sha256 in Objective-C for iPhone

Hi, when i use this code to create a sha256 of a string unsigned char hashedChars[32]; NSString *inputString; inputString = [NSString stringWithFormat:@"hello"]; NSData * inputData = [inputString dataUsingEncoding:NSUTF8StringEncoding]; CC_SHA256(inputData.bytes, inputData.length, hashedChars); it returns the hash correctly, but i nee...

Generating SHA-256 hash in Python 2.4 using M2Crypto

Is it possible to generate a SHA-256 hash using M2Crypto? Python 2.4's SHA module doesn't support 256, so I started using PyCrypto, only to find out that PyCrypto doesn't support PKCS#5 (needed elsewhere in my project.) I switched to M2Crypto as a result and now I would like to replace my PyCrypto SHA-256 call with an M2Crypto equivale...

Is any substring of an encrypted hash (md5, sha1) more "random" than another?

Here's 3 example md5 hashes $ md5 -s "1" && md5 -s "2" && md5 -s "3" MD5 ("1") = c4ca4238a0b923820dcc509a6f75849b MD5 ("2") = c81e728d9d4c2f636f067f89cc14862c MD5 ("3") = eccbc87e4b5ce2fe28308fd9f2a7baf3 Say I wanted to take 8 characters from any hash. Is the beginning part of the hash particularly more "random" than the end? middle? ...

Can't seem to generate hex-encoded string from SHA256 digest in Java

Can't seem to figure out where Im going wrong here: private static String generateHashFromFile(String filePath) { try { final int BUFSZ = 32768; MessageDigest sha = MessageDigest.getInstance("SHA-256"); FileInputStream in = new FileInputStream(filePath); BufferedInputStream is = new BufferedInputStream(in, BUFSZ); byte...

Using XEnroll to create a PKCS10 with SHA-256 Hash Algorithm

I am trying to create a SHA-256 PKCS10 using Microsoft´s CSP (Microsoft Enhanced RSA and AES Cryptographic Provider (Prototype)) but without success. I have to do this using the XEnroll API (Windows XP / SP3). Here´s the sample for generating a SHA-1 PKCS10 (works just fine!): Set Enroll=CreateObject("CEnroll.CEnroll.2") Enroll.provid...

SHA-256 password generator

i saw a javascript implementation of sha-256. i waana ask if it is safe (pros/cons wathever) to use sha-256 (using javascript implementation or maybe python standard modules) alogrithm as a password generator: i remember one password, put it in followed(etc) by the website address and use the generated text as the password for that webs...