On this page

← All documentation

Rox files and chart hashes

The .rox chart container, how Prism reads it, and the three identities of a chart (note hash, chart hash, chart version) with the API that takes each.

Prism talks about a chart in three ways. A .rox file holds it. Two hashes name it, and they are not interchangeable. This page tells you which one you hold and which API takes it.

The .rox file

.rox is the native binary chart of the Rhythm Open Exchange model, the rhythm-open-exchange crate (version 0.8.1, built from the copy in vendor/ for the game, the game server and the site alike). A file is the four magic bytes of the format, then a zstd frame holding an rkyv archive of the chart: key count, metadata, timing points (BPM and scroll velocity), notes (tap, hold, burst, mine), hitsounds. The definition of the layout is the crate's code.

Prism never trusts a .rox. The decoder inflates the frame into a bounded buffer and validates the archive before reading it.

Limit of the decoder Value
Decompressed archive 64 MiB
Notes 4,000,000
Timing points 1,000,000
Hitsounds 1,000,000

The game reads a chart file through one decoder picked from the file (.osu, .qua, .sm, .rox and the other formats the crate reads). For bytes it already holds, such as a chart fetched from the index, it decodes them as a .rox.

GET /api/charts/{hash}/rox serves the .rox of a chart the index holds. It is content-addressed: ETag is the hash and Cache-Control is immutable. The {hash} is a note hash. See Charts API.

The note hash

The note hash is the identity the index and the online boards know. It answers the question "is this the same notes pattern, wherever it was downloaded from".

It is BLAKE3 in key-derivation mode with the context pvng note hash v1 (version 1). It is fed with:

  1. The key count, one byte.
  2. The number of notes, a little-endian u64.
  3. The notes sorted by (start, column, kind, end), each as little-endian i64 start, the column byte, the kind byte (0 tap, 1 hold) and the little-endian i64 end.

Before hashing, every time is rounded to the nearest millisecond (half up), and the time of the first note is subtracted from all of them. A chart shifted as a whole by a whole number of milliseconds therefore has the same note hash. Only taps and holds count. Mines, bursts, timing points, metadata and audio are left out. There is no tolerance: two charts whose notes round to different milliseconds have different hashes.

The result is 64 lowercase hexadecimal characters.

The chart hash

The chart hash is the identity of the exact chart a play was made on. It is BLAKE3 over the notes and the timing points, to the microsecond, with no offset removed. The function counts mines and bursts when the chart it is given has them. The game hashes the chart as it plays it, from which it has removed mines and rolls. The full algorithm is in The .pvreplay file. It is 64 lowercase hexadecimal characters.

Because the note hash forgets a global offset, one note hash can have several chart hashes. An osu! set and an Etterna pack that hold the same notes with a 13.7 ms difference give one note hash and two chart hashes.

The chart version

A chart version is one chart hash under a note hash. The index keeps every version it reads: the first one under the note hash, the others as separate files under their chart hash. The game names the version it played, and the game server judges a play on that exact version when the index holds it. When the index does not hold it yet, the server falls back to its own copy aligned on the start of the first note, and the result may differ by one point.

Which API takes which

Where Takes
GET /api/charts/{hash} and /rox, /notes, and the other chart reads Note hash
Online boards, rankings and marathon reads by hash Note hash
prism://map/<hash> Note hash
scoreBegin on the game server Both: the note hash for the board, chartHash for the exact version played
.pvreplay Both, in the archive
.pvplaylist entry hash Chart hash
.pvmarathon entry Both: chartHash and noteHash

To import an osu! replay for a map you do not own, the game asks the site for the map by the MD5 of its .osu file and receives its note hash and the chart hash of that exact file.

Which one do I hold

  • A 64-hex string in a prism://map/ link, or in GET /api/charts/<hash>, is a note hash.
  • A 64-hex string inside a .pvplaylist or a .pvreplay named chart is a chart hash.
  • You cannot compute one from the other. To go from a chart hash to a note hash, decode the chart and hash it with the note hash rules. The crates game_core::chart_identity::chart_hash and note_hash::note_hash are the reference implementations.

Pitfalls

  • Do not send a note hash where a chart hash is expected, or the reverse: both are 64 hexadecimal characters and nothing in the text tells them apart. A playlist entry is a chart hash; GET /api/charts/<hash> takes a note hash.
  • A conversion that changes notes gives another chart. The ROX encoder writes mines as taps and rolls as holds, so a converted file has another hash.

Source in the game repository: crates/core/src/lib.rs,crates/core/src/chart_identity.rs,crates/note_hash/src/lib.rs,vendor/rhythm-open-exchange/src/formats/rox_native/decoder.rs,services/api/src/controllers/charts.rs,Cargo.toml