sha256

Implementation of Kraken API in Java

懵懂的女人 提交于 2019-11-27 18:36:01
问题 So I currently working on an implementation of the Kraken API for Java . I am using this sample code I found on http://pastebin.com/nHJDAbH8. The general usage as described by Kraken (https://www.kraken.com/help/api) is: API-Key = API key API-Sign = Message signature using HMAC-SHA512 of ( URI path + SHA256( nonce + POST data ) ) and base64 decoded secret API key and nonce = always increasing unsigned 64 bit integer otp = two-factor password ( if two-factor enabled, otherwise not required )

SHA256 in T-sql stored procedure

大兔子大兔子 提交于 2019-11-27 17:56:56
问题 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. 回答1: Update : SQL Server 2012 HASHBYTES() now supports SHA-256 and SHA-512 out of the box. HASHBYTES ( '<algorithm>', { @input | 'input' } ) <algorithm>::= MD2 | MD4 | MD5 | SHA | SHA1 | SHA2_256 | SHA2_512 Sure. You can do it in TSQL, but it will be much easier to implement it as a CLR Stored procedure. Here's an actual example, that simply uses the

What kind of hash algorithm is used for Hive's built-in HASH() Function

不羁岁月 提交于 2019-11-27 16:33:04
问题 What kind of hashing algorithm is used in the built-in HASH() function? I'm ideally looking for a SHA512/SHA256 hash, similar to what the SHA() function offers within the linkedin datafu UDFs for Pig. 回答1: HASH function (as of Hive 0.11) uses algorithm similar to java.util.List#hashCode. Its code looks like this: int hashCode = 0; // Hive HASH uses 0 as the seed, List#hashCode uses 1. I don't know why. for (Object item: items) { hashCode = hashCode * 31 + (item == null ? 0 : item.hashCode());

java aes 256 java.security.InvalidKeyException: Illegal key size after installation the policy [duplicate]

a 夏天 提交于 2019-11-27 15:16:41
问题 This question already has answers here : InvalidKeyException Illegal key size (5 answers) Closed 3 years ago . i have a problem with the encrypt of the bytes with an AES 256 key. I already installed the policy. Here's what I've done: download the file: http://www.oracle.com/technetwork/java/javase/downloads/jce-7-download-432124.html I moved the files local_policy and US_export_policy to the directory /Library/Java/JavaVirtualMachines/jdk1.7.0_40.jdk/Contents/Home/jre/lib/security i restart

c# and java - difference between hmacsha256 hash

早过忘川 提交于 2019-11-27 15:06:28
问题 I have the following code in Java: byte[] secretKey = secretAccessKey.getBytes("UTF-8"); SecretKeySpec signingKey = new SecretKeySpec(secretKey, "HmacSHA256"); Mac mac = Mac.getInstance("HmacSHA256"); mac.init(signingKey); byte[] bytes = data.getBytes("UTF-8"); byte[] rawHmac = mac.doFinal(bytes); String result = javax.xml.bind.DatatypeConverter.printBase64Binary(rawHmac); and the following code in C#: UTF8Encoding enc = new UTF8Encoding(); byte[] secretKey = enc.GetBytes(secretAccessKey);

SignTool Not Signing ClickOnce App Using SHA256, Only Uses SHA1

Deadly 提交于 2019-11-27 14:57:41
问题 I'm trying to sign my clickonce app. I have an EV code signing certificate that is using SHA256. The problem is that when I sign my app using the post build commands, it seems to be using SHA1 instead of SHA256. Here is a clip of the output window: Running Code Analysis... 1> Code Analysis Complete -- 0 error(s), 0 warning(s) 1> The following certificate was selected: 1> Issued to: Certificate Subject Name Here 1> 1> Issued by: DigiCert EV Code Signing CA (SHA2) 1> 1> Expires: Thu Apr 14 06

java hmac/sha512 generation

旧城冷巷雨未停 提交于 2019-11-27 13:34:55
问题 I have this php code which generate a HMAC (and not a simple message digest): <?php $key = "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF"; $binkey = pack("H*", $key); echo strtoupper(hash_hmac('sha512', "ABC", $binkey)); ?> And with ABC input its output is: 100A6A016A4B21AE120851D51C93B293D95B7D8A44B16ACBEFC2D1C9DF02B6F54FA3C2D6802E52FED5DF8652DDD244788A204682D2D1CE861FDA4E67F2792643 And I need to clone it in

Java: Calculate SHA-256 hash of large file efficiently

点点圈 提交于 2019-11-27 10:51:52
问题 I need to calculate a SHA-256 hash of a 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 almost the same time. I also tried the Bouncy Castle implementation, but it gave me the same result. Here is how I calculate the hash: int buff = 16384; try { RandomAccessFile file = new RandomAccessFile("T:\

How long is the SHA256 hash?

余生颓废 提交于 2019-11-27 10:30:31
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? Pascal MARTIN A sha256 is 256 bits long -- as its name indicates. If you are using an hexadecimal representation, each digit codes for 4 bits ; so you need 64 digits to represent 256 bits -- so, you need a varchar(64) , or a char(64) , as the length is always the same, not varying at all. And the demo : $hash = hash('sha256', 'hello, world!'); var_dump($hash); Will give you : $ php temp.php string(64)

signtool failing to dual sign SHA2 and SHA1 with timestamps

一笑奈何 提交于 2019-11-27 10:21:59
问题 We need to dual sign our binaries with SHA1 and SHA2 using signtool.exe, our certificate supports 256-bit SHA2. Using the Windows 8 SDK's signtool: e.g.: signtool.exe sign /as /fd sha256 /t http://timestamp.verisign.com/scripts/timstamp.dll /f "certificate.pfx" /p XXXXXXX "file.dll" (where XXXXXXX is our password for the certificate) fails with the cryptic error: SignTool Error: SignedCode::Sign returned error: 0x80070057 The parameter is incorrect. SignTool Error: An error occurred while