From: Heesob Park Date: 2010-11-11T11:41:41+09:00 Subject: [ruby-core:33136] [Ruby 1.9-Feature#4042][Open] String#crypt shoud not accepted "\x00" as a salt. Feature #4042: String#crypt shoud not accepted "\x00" as a salt. http://redmine.ruby-lang.org/issues/show/4042 Author: Heesob Park Status: Open, Priority: Normal Category: core, Target version: 1.9.x I noticed if the salt contains non ascii value, the result is platform dependant. Especially, the salt start with "\x00", the result is empty string on Linux. On Linux, ruby 1.9.3dev (2010-11-04 trunk 29682) [i686-linux] irb(main):001:0> "foo".crypt("\x00\x00") => "" irb(main):002:0> "foo".crypt("\x00\x01") => "" irb(main):003:0> "foo".crypt("\x01\x00") => "\x01\x01Rqd3mnMHSeY" irb(main):004:0> "foo".crypt("\x01\x01") => "\x01\x01EV3MX6qznTs" irb(main):005:0> "foo".crypt("ab") => "abQ9KY.KfrYrc" On Windows, ruby 1.9.3dev (2010-11-09 trunk 29737) [i386-mswin32_90] irb(main):001:0> "foo".crypt("\x00\x00") => "..XXIp7/c78Qo" irb(main):002:0> "foo".crypt("\x00\x01") => ".\x01XXIp7/c78Qo" irb(main):003:0> "foo".crypt("\x01\x00") => "\x01.XXIp7/c78Qo" irb(main):004:0> "foo".crypt("\x01\x01") => "\x01\x01XXIp7/c78Qo" irb(main):005:0> "foo".crypt('ab') => "abQ9KY.KfrYrc" I think that String#crypt shoud raise ArgError if "\x00" used as a salt. ---------------------------------------- http://redmine.ruby-lang.org