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 sigma0.rb:18

# coding: utf-8
require_relative "sha256lib.rb"

# -----
# σ0(x)
# -----
# σ0(x) = ROTR(7, x) ^ ROTR(18, x) ^ SHR(3, x)

# -----
# Input
# -----
# default
x = 0b00000000000000000011111111111111 # 0b11101001101101011101101110100101
# argument passed
x = ARGV[0].to_i(2) if ARGV[0] # binary
# 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
# ---------
system "clear"
puts "x:       #{bits(x)}"
puts "         #{'-'*32}"
puts "ROTR 7:  #{bits(x)}"
puts "ROTR 18: #{bits(x)}"
puts " SHR 3:  #{bits(x)}"
puts "         #{'-'*32}"
puts "σ0(x):"
sleep(0.1)

# ROTR(7, x)
(7+1).times do |i|
  system "clear"

View on GitHub (pinned to 871e976d69)

Solutions

  1. Pass the first argument as a binary string of 32 bits or fewer, e.g. `ruby sigma0.rb 00000000000000000011111111111111`.
  2. Count the bits in your input: ARGV[0].size must be <= 32. SHA-256 words are 32-bit, so trim or split longer inputs.

Example fix

ruby sigma0.rb 00000000000000000011111111111111

When it happens

Trigger: Thrown at sigma0.rb:18 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/3323b83bbc4b3a05. Report an issue: GitHub.