Message schedule
Expand sixteen initial words into the sixty-four words for each block.
Build it in your language
The tester treats your program as a black box: any language works. These are just the most convenient ones for this project.
Message Schedule Expansion ( and )
From the initial 16 words (), SHA-256 expands the schedule to 64 words () using bitwise rotations and shifts.
Mental Model: Schedule Recurrence Relation
For any index :
Where:
- All additions are modulo .
Your Goal in this Stage
Read a JSON object from stdin with op: "schedule-word", previous words, and target index. Compute under "word".
Input Format
{
"op": "schedule-word",
"words": [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 24],
"index": 16
}
Output Format
{
"word": 0
}
Step-by-Step Implementation Guide
- Bitwise helpers: Define 32-bit
ROTRandSHR. - Define and : Apply XOR bitwise combinations.
- Calculate word: Sum mod using
>>> 0. - Emit output: Print JSON with
word.
Acceptance Criteria
- ✅ Exact implementation of and .
- ✅ Strict modulo unsigned arithmetic.
Output and errors
Multiline examples are formatted for readability. Emit compact JSON without optional spaces, with properties in the order shown by the output examples, and a final newline. Keep logs off stdout. Tests compare exact text.
Invalid inputs use stderr containing error, empty stdout, and exit 1. Valid inputs exit 0. Serialize integer results as JSON integers.