blowfish

Converting Coldfusion encryption code to C#

。_饼干妹妹 提交于 2019-12-01 18:28:05
I have a Coldfusion page that includes a section of code that encrypts a variable like this: <cfset data64 = toBase64(key)> <cfset encryptedID = encrypt(getUser.ID, data64, "BLOWFISH", "Base64")> We're moving the site to a .NET-based CMS, and I need to convert this page to C#, but I'm running into trouble. I've successfully converted the first line to this: byte[] keyBytes = System.Text.Encoding.UTF8.GetBytes(key); string keyBase64 = System.Convert.ToBase64String(keyBytes); I've also added the blowfish.cs class found at https://defuse.ca/blowfish.htm , but I'm a little fuzzy on how to use this

Moving from mcrypt with Blowfish & ECB to OpenSSL

笑着哭i 提交于 2019-12-01 17:57:11
In the (not too distant) past a decision has been made (by someone who longer works here) to always 'encrypt' database IDs to something else, on the fly, whenever it was needed for external communication. Now, we've moved from PHP 5.x to PHP 7.0 for our main application, and our microservices scattered across our infrastructure are running either 7.0 or 7.1. The 7.1 servers keep throwing deprecation warnings for the mcrypt stuff. No biggie, just yet. But with PHP 7.2 around the corner, we want to keep updating and upgrading. Mcrypt is blocking. To save all the currently encrypted values in 60

Breaking 224-bit Blowfish encryption

独自空忆成欢 提交于 2019-12-01 06:47:58
I have a bunch of encrypted files that I want to decrypt (duh). I found out they are encrypted with Blowfish using a 224-bit key after some research. I know what the first few bytes of the plaintext looks like (it's kind of a header). Noting that I am not NSA nor do I have ridiculous computing power, is there any chance of me brute forcing the key within a reasonable time (eg: not the life of the universe)? I read somewhere that someone published an attack on the full-blown Blowfish (no pun intended) that reduces the search to 2^(n/2) but it mysteriously disappeared. Apparently it was some

Breaking 224-bit Blowfish encryption

£可爱£侵袭症+ 提交于 2019-12-01 05:32:32
问题 I have a bunch of encrypted files that I want to decrypt (duh). I found out they are encrypted with Blowfish using a 224-bit key after some research. I know what the first few bytes of the plaintext looks like (it's kind of a header). Noting that I am not NSA nor do I have ridiculous computing power, is there any chance of me brute forcing the key within a reasonable time (eg: not the life of the universe)? I read somewhere that someone published an attack on the full-blown Blowfish (no pun

php crypt() blowfish salt length backward compatible

♀尐吖头ヾ 提交于 2019-12-01 03:38:10
问题 I used crypt() to hash password, with a blowfish salt like this: $2a$, 2 digits, $, 21 chars in [a-zA-Z0-9] Here I made a mistake that chars length after third $ is 21 not 22. But it worked fine so I didn't find the error. It works on my desktop which running windows and php 5.4.4 and on AWS ec2 which running Amazon linux with php 5.3.x, with that too short salt. One day I updated AWS php to 5.5.14. then the problem occurred. crypt() return *0 all the time. After some try, I added a $ at end

PASSWORD_DEFAULT vs PASSWORD_BCRYPT

谁都会走 提交于 2019-11-30 17:28:58
What is the difference between PASSWORD_DEFAULT and PASSWORD_BCRYPT? Do they both use Blowfish encryption algorithm? What is cost in an algorithm? How to set up password_hash in PHP produce a 255-hash length instead of 60? Currently PASSWORD_BCRYPT is the only algorithm supported (using CRYPT_BLWFISH), therefore there is currently no difference between PASSWORD_DEFAULT and PASSWORD_BCRYPT . The purpose of PASSWORD_DEFAULT is to allow for the inclusion of additional algorithms in the future, whereupon PASSWORD_DEFAULT will always be used to apply the strongest supported hashing algorithm. Cost

Blowfish in CakePHP is generating different passwords everytime

谁说我不能喝 提交于 2019-11-30 09:33:23
问题 I'm having trouble implementing Blowfish Hashing in CakePHP. I've done it many times before but something really strange is happening this time. When I do this in my Model: <?php App::uses('BlowfishPasswordHasher', 'Controller/Component/Auth'); class Person extends AppModel { public $hasAndBelongsToMany = 'Client'; public $belongsTo = 'Role'; public function beforeSave($options = array()) { if (!$this->id) { $passwordHasher = new BlowfishPasswordHasher(); debug($passwordHasher->hash($this-

Blowfish salt length for the Crypt() function?

随声附和 提交于 2019-11-29 18:54:12
问题 According to the crypt() documentation, the salt needs to be 22 base 64 digits from the alphabet "./0-9A-Za-z". This is the code example they give: crypt('rasmuslerdorf', '$2a$07$usesomesillystringforsalt$'); The first confusing part is that salt has 25 characters, not 22. Question #1: Does that mean the salt is supposed to be longer than 22 characters? Then I tested the function myself and noticed something. If I use a 20 character salt, I get this // using 20 char salt: 00000000001111111111

to use CRYPT_BLOWFISH on php 5.2 that doesn't support it

大城市里の小女人 提交于 2019-11-29 15:37:16
I am running my page on PHP 5.2 that does not support CRYPT_BLOWFISH but CRYPT_MD5 , and have heard that the blowfish is much more safer than md5. Since I am not the supervisor thing, I can not upgrade PHP to a version that supports it. Is there any hack for using CRYPT_BLOWFISH on PHP 5.2? and, $hash_key = crypt($something, '$2a$anySalt'); is pasting '$2a$' at the very first side correct? quite confused. P.s. If I use crypt() with CRYPT_BLOWFISH , will bcrypt work well in the crypt() function? You can use PHPASS which has fallbacks to support systems that don't support CRYPT_BLOWFISH.

CakePHP - How do I implement blowfish hashing for passwords?

送分小仙女□ 提交于 2019-11-29 07:37:33
Struggling to find answers to a few basic questions about using Blowfish in Cake 2.4. AppController.php public $components = array( 'Auth' => array( 'authenticate' => array( 'Form' => array( 'fields' => array( 'username' => 'email' ), 'passwordHasher' => 'Blowfish' ) ) ), 'Cookie', 'Session' ); What now? How do I log in? UsersController.php public function login() { if (!empty($this->request->data)) { if ($this->Auth->login()) { $this->redirect($this->Auth->redirectUrl()); } } } What do I need to add to this? I'm getting the following error if I try to log in: Warning (512): Invalid salt: for