About this lab
Pikkola, tool No. 12
A hash is only useful if it is the same everywhere. Here is what runs, and what does not.
Five algorithms, one page
Every checksum page we used had a box, an advertisement and its own domain for each algorithm. Checking one release meant pasting the same file into three of them, at three different speeds, with three different ideas of progress. This page takes the file once.
How a large file is hashed
The file is opened through the browser's own file reader and read in slices of 8 MB. Each slice updates two running hash states, one for SHA-256 and one for MD5, so the file is read once and never held in memory whole.
A 4 GB image takes a few minutes in JavaScript. That is why there is a progress bar and a Stop button, and why the digests appear only when the last slice has been read.
Where the arithmetic comes from
SHA-1, SHA-256, SHA-384 and SHA-512 come from the browser's Web Crypto interface, except where a streaming pass is needed, and then the published algorithm is implemented in the page. MD5 is implemented here because browsers dropped it, and download pages did not.
Nothing is approximated. A digest from this page matches sha256sum, shasum -a 256 or certutil on the same bytes.
What it will not do
It will not verify a signature, generate a key or encrypt anything. The token panel reads the header and the payload and shows the signature as text, because a decoder that pretends to verify is worse than one that says it does not.
It keeps no history. A key typed into the HMAC panel lives in the field until the tab is closed.
If something is wrong
Write to hello@pikkola.com with the input and the digest you expected. For a checksum tool that is the whole bug report.
이 랩에 대해
피콜라, 12호기
해시는 어디서 계산해도 같은 값이 나올 때만 쓸모가 있습니다. 무엇이 돌고 무엇이 돌지 않는지 적어 둡니다.
다섯 알고리즘, 한 페이지
지금까지 쓴 체크섬 사이트는 알고리즘마다 입력칸과 광고와 도메인이 따로 있었습니다. 릴리스 하나를 확인하려고 같은 파일을 세 곳에 올리고, 세 가지 속도로 기다리고, 세 가지 진행 표시를 봐야 했습니다. 이 페이지는 파일을 한 번만 받습니다.
큰 파일을 해시하는 방법
브라우저의 파일 읽기로 파일을 열고 8MB씩 잘라 읽습니다. 조각마다 SHA-256과 MD5의 계산 상태를 함께 갱신하므로 파일은 한 번만 읽히고, 통째로 메모리에 올라가지 않습니다.
4GB 이미지는 자바스크립트로 몇 분 걸립니다. 진행 막대와 멈추기 버튼이 있고, 해시가 마지막 조각을 읽은 뒤에 나오는 이유입니다.
계산은 어디서 오는가
SHA-1, SHA-256, SHA-384, SHA-512는 브라우저의 Web Crypto에서 가져옵니다. 조각 단위 계산이 필요한 자리에서는 공개된 알고리즘을 페이지 안에 구현해 씁니다. MD5는 브라우저가 놓아 버린 알고리즘이라 여기에 구현했습니다. 배포 페이지는 아직 놓지 않았기 때문입니다.
어림하지 않습니다. 같은 바이트라면 여기서 나온 값이 sha256sum이나 shasum, certutil의 값과 같습니다.
하지 않는 일
서명을 검증하지 않고, 키를 만들지 않고, 암호화하지 않습니다. 토큰 패널은 헤더와 페이로드를 읽어 보여 주고 서명은 글자로 보여 줍니다. 검증하는 척하는 디코더는 하지 않는다고 말하는 디코더보다 나쁩니다.
기록을 남기지 않습니다. HMAC 패널에 적은 키는 탭을 닫을 때까지 그 칸에만 있습니다.
뭔가 잘못됐다면
입력값과 기대한 해시를 hello@pikkola.com으로 보내 주세요. 체크섬 도구에서는 그게 버그 리포트의 전부입니다.
このラボについて
Pikkola、ツール12
ハッシュはどこで計算しても同じ値になるときだけ役に立ちます。動くものと動かないものを書いておきます。
5つのアルゴリズム、1つのページ
これまで使ったチェックサムのサイトは、アルゴリズムごとに入力欄と広告とドメインが分かれていました。1つのリリースを確かめるために同じファイルを3か所へ上げ、3つの速さで待ち、3つの進み具合を見ていました。このページはファイルを一度だけ受け取ります。
大きなファイルをどう計算するか
ブラウザのファイル読み取りで開き、8MBずつ切り出して読みます。断片ごとにSHA-256とMD5の計算状態を同時に進めるので、ファイルは一度しか読まれず、丸ごとメモリに載りません。
4GBの画像はJavaScriptで数分かかります。進行バーと停止ボタンがある理由であり、ハッシュが最後の断片を読んだあとに出る理由です。
計算はどこから来るか
SHA-1、SHA-256、SHA-384、SHA-512はブラウザのWeb Cryptoから取ります。断片ごとの計算が必要な場所では、公開されたアルゴリズムをページ内に実装して使います。MD5はブラウザが見限った算法なのでここに実装しました。配布ページはまだ見限っていないからです。
近似はしません。同じバイトなら、ここで出た値は sha256sum や shasum、certutil の値と同じです。
しないこと
署名の検証も、鍵の生成も、暗号化もしません。トークンのパネルはヘッダーとペイロードを読んで見せ、署名は文字として見せます。検証するふりをするデコーダは、しないと言うデコーダより悪いからです。
履歴を残しません。HMACのパネルに書いた鍵は、タブを閉じるまでその欄にだけあります。
不具合があれば
入力と期待したハッシュを hello@pikkola.com まで。チェックサムの道具では、それが不具合の報告のすべてです。