sha1

Making a sha1-hash of a row in Oracle

浪子不回头ぞ 提交于 2019-11-27 03:21:40
问题 I'm having a problem with making a sha1-hash of a row in a select on an Oracle database. I've done it in MSSQL as follows: SELECT *,HASHBYTES('SHA1',CAST(ID as varchar(10)+ TextEntry1+TextEntry2+CAST(Timestamp as varchar(10)) as Hash FROM dbo.ExampleTable WHERE ID = [foo] However, I can't seem to find a similar function to use when working with Oracle. As far as my googling has brought me, I'm guessing dbms_crypto.hash_sh1 has something to do with it, but I haven't been able to wrap my brain

Compute SHA-1 of byte array

北城余情 提交于 2019-11-27 03:19:50
I'm looking for a way of getting an SHA-1 checksum with a Java byte array as the message. Should I use a third party tool or is there something built in to the JVM that can help? Pascal Thivent What about: import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import java.util.Formatter; public static String SHAsum(byte[] convertme) throws NoSuchAlgorithmException{ MessageDigest md = MessageDigest.getInstance("SHA-1"); return byteArray2Hex(md.digest(convertme)); } private static String byteArray2Hex(final byte[] hash) { Formatter formatter = new Formatter(); for

SHA1 hashing in Delphi XE

瘦欲@ 提交于 2019-11-27 01:59:23
问题 I'm in the process of implementing XML digital signatures. I'm starting with little steps, so right now I want to solve the problem of SHA-1 hashing. There are lots of questions about this in SO: Digitially Sign Key with Lockbox Encryption library for Delphi Convert this php digital signing to Delphi Delphi: is there a version of LockBox for Delphi-XE Delphi 2010 Cryptography libraries ...and probably more. However, I'm using Delphi XE. So far, I've tried LockBox 2 (both the Songbeamer and

How do you securely store a user's password and salt in MySQL?

耗尽温柔 提交于 2019-11-27 01:02:24
问题 So, I found out on SO that you're supposed to hash the password together with a "salt". (The articles can be found here and here.) Here's the code: $password = 'fish'; /* should be "unique" for every user? */ $salt= 'ABC09'; $site_key = 'static_site_key'; hash_hmac('sha1', $password . $salt, $site_key); And now I need to save both the $password and $salt in MySQL, like so: +---------+--------+----------+-------+ | user_id | name | password | salt | +---------+--------+----------+-------+ | 1

Objective C: SHA1

倖福魔咒の 提交于 2019-11-27 00:27:08
How do i sha1 a string or set of numbers in Objective c? CommonCrypto (an Apple framework) has functions for calculating SHA-1 hashes, including a one-step hash: #include <CommonCrypto/CommonDigest.h> unsigned char digest[CC_SHA1_DIGEST_LENGTH]; NSData *stringBytes = [someString dataUsingEncoding: NSUTF8StringEncoding]; /* or some other encoding */ if (CC_SHA1([stringBytes bytes], [stringBytes length], digest)) { /* SHA-1 hash has been calculated and stored in 'digest'. */ ... } For a set of numbers, let us assume you mean an array of ints of known length. For such data, it is easier to

How do you verify an RSA SHA1 signature in Python?

回眸只為那壹抹淺笑 提交于 2019-11-27 00:22:43
I've got a string, a signature, and a public key, and I want to verify the signature on the string. The key looks like this: -----BEGIN PUBLIC KEY----- MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDfG4IuFO2h/LdDNmonwGNw5srW nUEWzoBrPRF1NM8LqpOMD45FAPtZ1NmPtHGo0BAS1UsyJEGXx0NPJ8Gw1z+huLrl XnAVX5B4ec6cJfKKmpL/l94WhP2v8F3OGWrnaEX1mLMoxe124Pcfamt0SPCGkeal VvXw13PLINE/YptjkQIDAQAB -----END PUBLIC KEY----- I've been reading the pycrypto docs for a while, but I can't figure out how to make an RSAobj with this kind of key. If you know PHP, I'm trying to do the following: openssl_verify($data, $signature,

HMAC-SHA1: How to do it properly in Java?

て烟熏妆下的殇ゞ 提交于 2019-11-27 00:08:26
问题 I'm hashing some values using HMAC-SHA1, using the following code in Java: public static String hmacSha1(String value, String key) { try { // Get an hmac_sha1 key from the raw key bytes byte[] keyBytes = key.getBytes(); SecretKeySpec signingKey = new SecretKeySpec(keyBytes, "HmacSHA1"); // Get an hmac_sha1 Mac instance and initialize with the signing key Mac mac = Mac.getInstance("HmacSHA1"); mac.init(signingKey); // Compute the hmac on input data bytes byte[] rawHmac = mac.doFinal(value

Why does git hash-object return a different hash than openssl sha1?

China☆狼群 提交于 2019-11-26 22:55:45
问题 Context: I downloaded a file (Audirvana 0.7.1.zip) from code.google to my Macbook Pro (Mac OS X 10.6.6). I wanted to verify the checksum, which for that particular file is posted as 862456662a11e2f386ff0b24fdabcb4f6c1c446a (SHA-1). git hash-object gave me a different hash, but openssl sha1 returned the expected 862456662a11e2f386ff0b24fdabcb4f6c1c446a. The following experiment seems to rule out any possible download corruption or newline differences and to indicate that there are actually two

Reimplement ASP.NET Membership and User Password Hashing in Ruby

南笙酒味 提交于 2019-11-26 22:54:54
问题 I have a large database of users (~200,000) that I'm transferring from a ASP.NET application to a Ruby on Rails application. I don't really want to ask every user to reset their password and so I'm trying to re-implement the C# password hashing function in Ruby. The old function is this: public string EncodePassword(string pass, string saltBase64) { byte[] bytes = Encoding.Unicode.GetBytes(pass); byte[] src = Convert.FromBase64String(saltBase64); byte[] dst = new byte[src.Length + bytes

Is calculating an MD5 hash less CPU intensive than SHA family functions?

孤街醉人 提交于 2019-11-26 22:17:17
Is calculating an MD5 hash less CPU intensive than SHA-1 or SHA-2 on "standard" laptop x86 hardware? I'm interested in general information, not specific to a certain chip. UPDATE: In my case, I'm interested in calculating the hash of a file. If file-size matters, let's assume its 300K. Yes, MD5 is somewhat less CPU-intensive. On my Intel x86 (Core2 Quad Q6600, 2.4 GHz, using one core), I get this in 32-bit mode: MD5 411 SHA-1 218 SHA-256 118 SHA-512 46 and this in 64-bit mode: MD5 407 SHA-1 312 SHA-256 148 SHA-512 189 Figures are in megabytes per second, for a "long" message (this is what you