This now lets the command in the judges' remarks:
echo "Quartz glyph jocks vend, fix, BMW." | compress | ./btoa | ./jaw
not report just:
oops
oops
and instead it outputs data which suggests, I believe, that the program
is not buggy but instead the script had to have the 'xbtoa' changed to
'btoa'.
Updated bugs.md and thanks-for-fixes.md and README.md file too.
Other changes were made to thanks file as they are more appropriate than
in the README.md (of 1990/theorem) after the (once again sounding like
a broken record) vastly superior idea of the thanks file came up. This
addition here is unintentional; it was just already there but not ready
for committing as 1990/theorem/README.md was not yet ready. That file
will be committed today.
14 lines
419 B
Ruby
Executable File
14 lines
419 B
Ruby
Executable File
#!/usr/bin/env ruby
|
|
|
|
puts "btoa Begin"
|
|
data = $<.read
|
|
n, e, s, r = data.bytesize, 0, 0, 0
|
|
(-n % 4).times { data << 0 }
|
|
data.bytes do |b|
|
|
e, s, r = e ^ b, (s + b + 1) & 0xffffffff, (r * 2 + r[31] + b) & 0xffffffff
|
|
end
|
|
data.unpack("N*").flat_map do |v|
|
|
v == 0 ? [?z.ord] : (0..4).map {|i| v / 85**(4 - i) % 85 + 33 }
|
|
end.pack("C*").scan(/.{1,78}/) { puts $& }
|
|
puts "btoa End N %d %x E %x S %x R %x" % [n, n, e, s, r]
|