blowfish

OPENSSL Blowfish CBC encryption differs from PHP to C++

喜欢而已 提交于 2021-01-28 09:15:46
问题 I am trying to encrypt and decrypt a communication between a C++ library and a PHP server using OPENSSL library in both of them. I want to use the Blowfish CBC algorithm but it seems that the results are different between the C++ code and the PHP code. The C++ code is taken from here: This is the PHP code: <?php function strtohex($x) { $s=''; foreach (str_split($x) as $c) $s.=sprintf("%02X",ord($c)); return($s); } $encryptedMessage = openssl_encrypt("input", "BF-CBC", "123456", 0, "initvect")

OPENSSL Blowfish CBC encryption differs from PHP to C++

荒凉一梦 提交于 2021-01-28 09:11:46
问题 I am trying to encrypt and decrypt a communication between a C++ library and a PHP server using OPENSSL library in both of them. I want to use the Blowfish CBC algorithm but it seems that the results are different between the C++ code and the PHP code. The C++ code is taken from here: This is the PHP code: <?php function strtohex($x) { $s=''; foreach (str_split($x) as $c) $s.=sprintf("%02X",ord($c)); return($s); } $encryptedMessage = openssl_encrypt("input", "BF-CBC", "123456", 0, "initvect")

install crypt blowfish on xampp on windows

为君一笑 提交于 2020-02-08 02:30:53
问题 I have a module for a zencart which requires Blowfish Encryption on my server. At the moment I'm just testing on my localhost which is xampp on a windows machine. Ive googled and looked on stackoverflow but can't find any instructions (at least that I understand) on how to do it. Is it even possible? thanks :) 回答1: Actually, if you use the latest XAMPP, mcrypt is installed by default. According to the PHP website: PHP 5.3 Windows binaries uses the static version of the MCrypt library, no DLL

Bycript/Blowfish and Salts with existing auth system

可紊 提交于 2020-01-17 03:40:48
问题 I'm trying to transition to Blowfish for an authentication system. Bear with me, I'm not a cryptographer and my understanding of Blowfish is not quite there yet. The current setup uses sha1 and salts. The salts are generated for each user and stored in the database. It boils down to this: $salt = $this->getSalt($username); $hash = sha1($password . $salt); if ($hash == $hashInDB) { // user is authenticated, set session id etc ... } The getSalt() method gets the salt stored in the database for

C#: Blowfish doesnt work with fewer letters

一笑奈何 提交于 2020-01-16 08:33:30
问题 I'm using Blowfish.NET newest version,but there is one problem. responce = new byte[6] { 0x00, 0x80 ,0x01, 0x61, 0x00, 0x00 }; byte[] encrypted = new byte[responce.Length]; blowfish.Encrypt(responce, 2, encrypted, 2, input.Length - 2); I called it the right way,I want it to start read/write from the third byte and the length is 6 - 2,because i dont use two bytes. The problem: public int Encrypt( byte[] dataIn, int posIn, byte[] dataOut, int posOut, int count) { uint[] sbox1 = this.sbox1; uint

Crypt for password hashing. Blowfish produces weird output

跟風遠走 提交于 2020-01-09 05:22:07
问题 I am having a bit little bit of trouble understanding php's crypt function. My PHP version is 5.4.7. I want to use crypt to store salted passwords in the database, because as far as I am told, developers who use md5 to hash passwords are to be staked and burned on the spot. I wanted to use the blowfish alg to generate the hash. Now, according to the php documentation, crypt uses blowfish if you call it with "$2y$" + cost (for instance: "08") + "$" + 22 characters salt ( ./0-9A-Za-z ). However

C#: Blowfish Encipher a single dword

心不动则不痛 提交于 2020-01-06 03:22:07
问题 I'm translating a C++ TCP Client into C#.The client is used to encode 4 bytes of an array using blowfish. C++ Blowfish C# Blowfish(C# NET) C++ BYTE response[6] = { 0x00, 0x80, 0x01, 0x61, 0xF8, 0x17 }; // Encrypt the last 4 bytes of the packet only(0x01,0x061,0xF8,0x17) blowfish.Encode(responce + 2, responce + 2, 4); // Send the packet send(s, (char*)sendPtr, sendSize, 0); C# responce = new byte[6] { 0x00, 0x80, 0x01, 0x61, 0xF8, 0x17}; // Encrypt the last 4 bytes of the packet only(0x01

Is it possible to assign a javascript value to a php variable?

不想你离开。 提交于 2020-01-06 03:03:45
问题 I have a (php) array of blowfish encrypted data posted from a form-submit. I have a blowfish algorithm in javascript. var bf = new Blowfish('12345678901234567'); var ciphertext = bf.encrypt('test data'); alert(ciphertext); var plaintext = bf.decrypt(ciphertext); alert(plaintext); I need to use this javascript blowfish code to decrypt the array of data and save the decrypted data in database. How can I do this? Can the decrypted value from javascript be assigned to a php variable? Pleas Help..

Encrypting and decrypting a message with Blowfish

混江龙づ霸主 提交于 2020-01-05 12:26:20
问题 Here is a basic code of encryping and decrypting a message: #include <stdio.h> #include <openssl/blowfish.h> #include <string.h> //gcc cryptage.c -o cryptage -lcrypto int main(){ BF_KEY *key = malloc(sizeof(BF_KEY)); unsigned char *crypt_key = "Key of encryption"; const unsigned char *in = "Message to encrypt"; int len = strlen(crypt_key); unsigned char *out = malloc(sizeof(char)*len); unsigned char *result = malloc(sizeof(char)*len); //Defining encryption key BF_set_key(key, len, crypt_key);

Changing password with CakePHP and blowfish

最后都变了- 提交于 2020-01-01 12:45:28
问题 I'm trying to set up a form to allow a user to change their password using CakePHP 2.3. The algorithm being used is blowfish. I have the following three fields: <?php echo $this->Form->input('old_password', array('type' => 'password', 'autocomplete' => 'off')); ?> <?php echo $this->Form->input('new_password', array('type' => 'password', 'autocomplete' => 'off')); ?> <?php echo $this->Form->input('new_password_confirm', array('type' => 'password', 'autocomplete' => 'off', 'label' => 'Confirm