sha

Is MD5 less secure than SHA et. al. in a practical sense?

雨燕双飞 提交于 2019-11-26 17:48:06
问题 I've seen a few questions and answers on SO suggesting that MD5 is less secure than something like SHA. My question is, Is this worth worrying about in my situation? Here's an example of how I'm using it: On the client side, I'm providing a "secure" checksum for a message by appending the current time and a password and then hashing it using MD5. So: MD5(message+time+password) . On the server side, I'm checking this hash against the message that's sent using my knowledge of the time it was

How do I calculate the equivalent to SQL Server (hashbytes('SHA1',[ColumnName])) in C#?

岁酱吖の 提交于 2019-11-26 17:07:39
问题 In my database I have a computed column that contains a SHA1 hash of a column called URLString which holds URLs (e.g. "http://xxxx.com/index.html"). I often need to query the table to find a specific URL based on the URLString column. The table contains 100K's and these queries take several seconds (using SQL Azure). Since URLs can be quite long, I cannot create an index on this column (above 450 bytes). To speed things up I want to calculate the equivalent of SQL Server hashbytes('SHA1',

How much of a git sha is *generally* considered necessary to uniquely identify a change in a given codebase?

你离开我真会死。 提交于 2019-11-26 15:39:12
If you're going to build, say, a directory structure where a directory is named for a commit in a Git repository, and you want it to be short enough to make your eyes not bleed, but long enough that the chance of it colliding would be negligible, how much of the SHA substring is generally required? Let's say I want to uniquely identify this change: https://github.com/wycats/handlebars.js/commit/e62999f9ece7d9218b9768a908f8df9c11d7e920 I can use as little as the first four characters: https://github.com/wycats/handlebars.js/commit/e629 But I feel like that would be risky. But ssuming a codebase

Method not found using DigestUtils in Android

﹥>﹥吖頭↗ 提交于 2019-11-26 15:07:16
I am trying to use the library DigestUtils in Android 2.3.1 using JDK 1.6, however I get the following error when executing the app: Could not find method org.apache.commons.codec.binary.Hex.encodeHexString, referenced from method org.apache.commons.codec.digest.DigestUtils.shaHex Here you have the stacktrace: 02-03 10:25:45.153: I/dalvikvm(1230): Could not find method org.apache.commons.codec.binary.Hex.encodeHexString, referenced from method org.apache.commons.codec.digest.DigestUtils.shaHex 02-03 10:25:45.153: W/dalvikvm(1230): VFY: unable to resolve static method 329: Lorg/apache/commons

Is it safe to ignore the possibility of SHA collisions in practice?

空扰寡人 提交于 2019-11-26 12:03:29
Let's say we have a billion unique images, one megabyte each. We calculate the SHA-256 hash for the contents of each file. The possibility of collision depends on: the number of files the size of the single file How far can we go ignoring this possibility, assuming it is zero? Thomas Pornin The usual answer goes thus: what is the probability that a rogue asteroid crashes on Earth within the next second, obliterating civilization-as-we-know-it, and killing off a few billion people? It can be argued that any unlucky event with a probability lower than that is not actually very important. If we

Why doesn't Git use more modern SHA?

为君一笑 提交于 2019-11-26 10:24:32
问题 I read about that Git uses SHA-1 digest as an ID for a revision. Why does it not use a more modern version of SHA? 回答1: Why does it not use a more modern version of SHA? Dec. 2017: It will. And Git 2.16 (Q1 2018) is the first release to illustrate and implement that intent. Note: see Git 2.19 below: it will be SHA-256 . Git 2.16 will propose an infrastructure to define what hash function is used in Git, and will start an effort to plumb that throughout various codepaths. See commit c250e02

Improve password hashing with a random salt

混江龙づ霸主 提交于 2019-11-26 09:42:08
问题 I\'m starting a website and I\'m trying to decide how to encrypt user passwords to store them in a SQL database. I realize that using a simple md5(password) is very unsecured. I\'m considering using a sha512(password.salt), and I have been researching the best way to generate a useful salt. I read numerous articles stating that a salt should be as random as possible to add entropy to the hash and it looks like a great idea. But: you need to store the random salt along with your hash given

Method not found using DigestUtils in Android

烈酒焚心 提交于 2019-11-26 03:50:12
问题 I am trying to use the library DigestUtils in Android 2.3.1 using JDK 1.6, however I get the following error when executing the app: Could not find method org.apache.commons.codec.binary.Hex.encodeHexString, referenced from method org.apache.commons.codec.digest.DigestUtils.shaHex Here you have the stacktrace: 02-03 10:25:45.153: I/dalvikvm(1230): Could not find method org.apache.commons.codec.binary.Hex.encodeHexString, referenced from method org.apache.commons.codec.digest.DigestUtils

Is it safe to ignore the possibility of SHA collisions in practice?

自闭症网瘾萝莉.ら 提交于 2019-11-26 02:28:02
问题 Let\'s say we have a billion unique images, one megabyte each. We calculate the SHA-256 hash for the contents of each file. The possibility of collision depends on: the number of files the size of the single file How far can we go ignoring this possibility, assuming it is zero? 回答1: The usual answer goes thus: what is the probability that a rogue asteroid crashes on Earth within the next second, obliterating civilization-as-we-know-it, and killing off a few billion people? It can be argued

php mysqli_connect: authentication method unknown to the client [caching_sha2_password]

梦想的初衷 提交于 2019-11-25 23:16:56
问题 I am using php mysqli_connect for login to a MySQL database (all on localhost) <?php //DEFINE (\'DB_USER\', \'user2\'); //DEFINE (\'DB_PASSWORD\', \'pass2\'); DEFINE (\'DB_USER\', \'user1\'); DEFINE (\'DB_PASSWORD\', \'pass1\'); DEFINE (\'DB_HOST\', \'127.0.0.1\'); DEFINE (\'DB_NAME\', \'dbname\'); $dbc = mysqli_connect(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME); if(!$dbc){ die(\'error connecting to database\'); } ?> this is the mysql.user table: MySQL Server ini File: [mysqld] # The default