in3rsha/sha256-animation · error

We only operate on 32-bit words in SHA-256. Your x is #{ARGV

Error message

We only operate on 32-bit words in SHA-256. Your x is #{ARGV[0].size} bits.

What it means

Error "We only operate on 32-bit words in SHA-256. Your x is #{ARGV[0].size} bits." thrown in in3rsha/sha256-animation.

Source

Thrown at shr.rb:19

# -----------
# Shift Right
# -----------
def shr(n, x)
  x >> n
end

# -----
# Input
# -----
# defaults
x = 0b11111111000000001111111100000000 #0b11101001101101011101101110100101
n = 32     
# arguments passed
x = ARGV[0].to_i(2) if ARGV[0] # binary
n = ARGV[1].to_i    if ARGV[1] # integer
# check arguments
if ARGV[0] && ARGV[0].size > 32
	puts "We only operate on 32-bit words in SHA-256. Your x is #{ARGV[0].size} bits."; exit
end

# ---------
# Animation
# ---------
s = n.to_s.ljust(2, " ")
n.times do |i|
  system "clear"
  i += 1

  puts "      x: #{"%032b" % x}"
  puts " SHR #{s}: #{"%032b" % shr(i, x)}"

  sleep 0.1
end
sleep 0.4

View on GitHub (pinned to 871e976d69)

Solutions

  1. Pass the first argument as a binary string of 32 bits or fewer, e.g. `ruby shr.rb 11111111000000001111111100000000 4`.
  2. Count the bits in your input: ARGV[0].size must be <= 32. Remove extra digits or split the value into 32-bit words.

Example fix

ruby shr.rb 11111111000000001111111100000000 4

When it happens

Trigger: Thrown at shr.rb:19 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of in3rsha/sha256-animation@871e976d69 (2026-08-23). Data as JSON: /api/errors/35be5cef77b95c1e. Report an issue: GitHub.