@mikeTheLiar said:
I honestly cannot fathom how you can get to this point of security failure.
A single string.isNullOrWhitespace(pass) instead of string.isNullOrEmpty(pass) would do it.
@mikeTheLiar said:
I honestly cannot fathom how you can get to this point of security failure.
A single string.isNullOrWhitespace(pass) instead of string.isNullOrEmpty(pass) would do it.
@boomzilla said:
I think TRWTF is saying, "It's similar to sprintf("%02x", hex($hexStr));" because it's really like, sprintf("%b", hex($hexStr)).
Yes, my typo, not 02x but 08b. The input in our case is always 8 bits and the desired output is always 8 chars.
This is a coworkers' implementation of Hex2Bin, in Perl. It's similar to sprintf("%02x", hex($hexStr)); ##################################################################################### #Hex2Bin - Convert HEX to Binary # Input parameters: $HEX # Returns: $Binary ##################################################################################### sub Hex2Bin { my $hex = shift; my $binary; local $/ = ''; my %h2b = (0 => "0000", 1 => "0001", 2 => "0010", 3 => "0011", 4 => "0100", 5 => "0101", 6 => "0110", 7 => "0111", 8 => "1000", 9 => "1001", "a" => "1010", "b" => "1011", "c" => "1100", "d" => "1101", "e" => "1110", "f" => "1111", "A" => "1010", "B" => "1011", "C" => "1100", "D" => "1101", "E" => "1110", "F" => "1111", ); $binary = $hex; $binary =~ s/(.)/$h2b{lc $1}/g; return $binary; } PS: First post, seems that editor needs explicit formatting to be added? Just used "pre" tag ... sorry about that.