haxe-crypto icon indicating copy to clipboard operation
haxe-crypto copied to clipboard

BlowFish encrypt issue

Open skliarovartem opened this issue 9 years ago • 2 comments

in encrypt method we need to encrypt all blocks, so: public function encrypt(block:ByteArray, index:Int32 = 0):Void { var count:Int = block.length >>> 3; var i:Int = 0; for (i in 0...count) encryptBlock(block, 8 * i, block, 8 * i); }

skliarovartem avatar Aug 22 '16 11:08 skliarovartem

same for decrypt: public function decrypt(block:ByteArray, index:Int32 = 0):Void { var count:Int = block.length >>> 3; var i:Int = 0;

    for (i in 0...count)
        decryptBlock(block, 8 * i, block, 8 * i);
}

skliarovartem avatar Aug 22 '16 17:08 skliarovartem

Please, do a PR so I can merge it. You should remove index argument then. Also create a test here that checks the right behaviour: https://github.com/soywiz/haxe-crypto/blob/master/test/com/hurlant/tests/crypto/symmetric/BlowFishKeyTest.hx

soywiz avatar Aug 22 '16 21:08 soywiz