[#89806] [Ruby trunk Bug#15306] Generate prelude.c using miniruby — v.ondruch@...
Issue #15306 has been reported by vo.x (Vit Ondruch).
3 messages
2018/11/15
[ruby-core:89826] [Ruby trunk Bug#15309] ECB is broken
From:
sevkme@...
Date:
2018-11-16 01:56:36 UTC
List:
ruby-core #89826
Issue #15309 has been updated by sevk (kk kk).
test encry:
FAILED!
test decry:
OK!
----------------------------------------
Bug #15309: ECB is broken
https://bugs.ruby-lang.org/issues/15309#change-74885
* Author: sevk (kk kk)
* Status: Open
* Priority: Normal
* Assignee:
* Target version:
* ruby -v: ruby 2.5.3p105 (2018-10-18 revision 65156) [x86_64-linux]
* Backport: 2.3: UNKNOWN, 2.4: UNKNOWN, 2.5: UNKNOWN
----------------------------------------
~~~ ruby
#!/usr/bin/env ruby
require 'openssl'
# AES-128 ECB mode test vectors
KEY = ["2b7e151628aed2a6abf7158809cf4f3c"].pack("H*")
PLAINTEXT = ["6bc1bee22e409f96e93d7e117393172a"].pack("H*")
CIPHERTEXT = ["3ad77bb40d7a3660a89ecaf32466ef97"].pack("H*")
cipher = OpenSSL::Cipher::Cipher.new("aes-128-ecb")
cipher.key = KEY
cipher.padding = 0 # Padding is enabled by default o_O
puts "test encry: "
cipher.encrypt
ciphertext = cipher.update(PLAINTEXT) << cipher.final
if ciphertext == CIPHERTEXT
puts "OK!"
else
puts "FAILED!"
end
puts "test decry: "
cipher.reset
cipher.decrypt
plaintext = cipher.update(CIPHERTEXT) << cipher.final
if plaintext == PLAINTEXT
puts "OK!"
else
puts "FAILED!"
end
~~~
--
https://bugs.ruby-lang.org/
Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>