crypt

Good cryptographic hash functions [duplicate]

扶醉桌前 提交于 2019-12-05 03:45:01
Possible Duplicate: Secure hash and salt for PHP passwords I am making a website, and I need a secure algorithm to store passwords. I was first thinking of bcrypt, but then I found out my host did not support it and I am not able to change host. My host allow this encryption: Standard DES And these hashes: MD5 md2, md4 & md5 sha1, sha256, sha384 & sha512 ripemd128, ripemd160, ripemd256 and ripemd360 whirlpool tiger128,3, tiger160,3, tiger192,3, tiger128,4, tiger160,4 & tiger192,4 snefru gost adler32 crc32 & crc32b haval128,3, haval160,3, haval192,3, haval224,3, haval256,3, haval128,4, haval160

java - make string unreadable [closed]

与世无争的帅哥 提交于 2019-12-04 22:05:44
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center . Closed 6 years ago . I need an as short and fast as possible code to change a String to something unreadable (for humans that is), and also to make it readable again. It all needs to happen in java. Something like this: encrypt("test"); Would result in something like this: ôT¿ÄÜTV CÁˆ“5="ËÂÀœššbÀß{¡ä³ and decrypt("ôT¿ÄÜTV CÁˆ“5 1=

Generating crypt() sha512 hashes in Go

旧巷老猫 提交于 2019-12-04 21:21:42
I am working on my authorization module in GoLang. Before we used PHP5 with the crypt function. The hash was generated like SHA-512: $6$rounds=5000$usesomesillystri$D4IrlXatmP7rx3P3InaxBeoomnAihCKRVQP22JZ6EY47Wc6BkroIuUUBOov1i.S5KPgErtP/EN5mcO.ChWQW21 And stored like that in the database. But now I need make it work also in GoLang. I have searched on Google and tried different things, such as: t512 := sha512_crypt.Crypt("rasmuslerdorf", "$6$usesomesillystringforsalt$") fmt.Printf("hash: %v\n", t512) But all generate different things. Who can help us further? We want validate and create hashes

PHP storing password with blowfish & salt & pepper

本秂侑毒 提交于 2019-12-04 19:02:52
I want to store secure user passwords in a MySQL database with PHP. How can I make it better? My Class: private static $algo = '$2a'; private static $cost = '$10'; private static $pepper = 'eMI8MHpEByw/M4c9o7sN3d'; public static function generateSalt($length) { $randomBinaryString = mcrypt_create_iv($length, MCRYPT_DEV_URANDOM); $randomEncodedString = str_replace('+', '.', base64_encode($randomBinaryString)); return substr($randomEncodedString, 0, $length); } public static function generateHash($password) { if (!defined('CRYPT_BLOWFISH')) die('The CRYPT_BLOWFISH algorithm is required (PHP 5.3)

Determining the salt from a password_hash()

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-04 14:41:17
问题 I'm hashing my password with bcrypt (actually with password_compat since I run php 5.3.10) I wanted to split the result string of the function into two parts: the salt used and the hash itself. (I know to use password_verify() to verify, well, the password. But I need the hash to use it as a key to encrypt a private key in a more broader security system.) For a given password (abcdef) this is the result: $2y$10$ult68Ti4/zEWX4VQ .... YCOWjL6 I've altered the function a little bit, to spit out

Correctly using crypt() with SHA512 in PHP

主宰稳场 提交于 2019-12-04 08:25:42
All the examples online show the use of crypt like this: $pass = crypt('something','$6$rounds=5000$anexamplestringforsalt$'); But everyone says that you are not supposed to define the rounds or the salt. So how should I use it? Also I am having a problem: when I run the code above, it only runs 50 rounds instead of 5000 rounds as if the system is stopping it. Any help will be greatly appreciated. //- Solution -// I have found some of these to be useful: For generating Salt: $salt = substr(str_shuffle("./ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz012345‌​6789"), 0, 8); or if you have a

How do I replace the cakephp password hashing algorithm?

半世苍凉 提交于 2019-12-04 05:46:56
I have an existing database I'm trying to put a cake app on top of. The old app used crypt() in Perl to hash the passwords. I need to do the same in the PHP app. Where is the correct place to make that change in a standard cakephp app? And what would such a change look like? I got it working... here is my AppController: class AppController extends Controller { var $components = array('Auth'); function beforeFilter() { // this is part of cake that serves up static pages, it should be authorized by default $this->Auth->allow('display'); // tell cake to look on the user model itself for the

strcmp vs. == vs. === in PHP for checking hash equality

你说的曾经没有我的故事 提交于 2019-12-03 23:07:26
I'm using crypt() to hash passwords in PHP, and am trying to work out the safest way of testing equality of the resulting hash when performing password checks. There are three options that I can see: Option 1 - Double Equals function checkPassword($hash, $password) { return crypt($password, $hash) == $hash; } Option 2 - Triple Equals function checkPassword($hash, $password) { return crypt($password, $hash) === $hash; } Option 3 - strcmp() function checkPassword($hash, $password) { return strcmp(crypt($password, $hash), $hash) === 0; } My intuition tells me that option 1 is a bad idea, due to

Which hashing algorithm provides the longest output?

天大地大妈咪最大 提交于 2019-12-03 11:50:45
问题 I was curious about which hashing method usable by PHP's crypt function provides the longest output, and also, if the length of the output was relative at the chance of their being a collision of two hashes. 回答1: See this comment on the PHP docs for hash(): alg strlen hash (cropped) md2 32 a9046c73e00331af68917d3804f70655 md4 32 866437cb7a794bce2b727acc0362ee27 md5 32 5d41402abc4b2a76b9719d911017c592 sha1 40 aaf4c61ddcc5e8a2dabede0f3b482cd9aea9434d sha256 64

PHP crypt and salt - more clarification please

匿名 (未验证) 提交于 2019-12-03 08:39:56
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I was here yesterday and got some really great answers. I took what I got and put together, what I think will be a fairly secure algorithm. I'm having a problem using blowfish with a for loop that generates the salt. I'm using base64 characters and a for loop to get a random string. I want to take this generated string and insert it into the crypt function as the salt. Because the documentation about blowfish is so sparse and the PHP docs don't really even mention it, I'm sort of stabbing in the dark here. The really strange thing