Algorithm Spec · v1.0 · Open Source
Fair Instagram Giveaway Algorithm — Verifiable Random Winner Selection
Deterministic, publishable algorithm: SHA-256(input) → HMAC-DRBG → Fisher-Yates.
Every Instagram giveaway draw on Rafflecopter is mathematically reproducible. Anyone — host, follower, regulator — can re-run the algorithm from public inputs and arrive at the exact same winner.
Winner selected
Verified@ana.silveira
Picked from 8,421 eligible comments · 1 of 1
SHA-256 seed (publishable)
a3f29c4b8e1d50f6b2c7a98e4d1c0b5a6f9d3e2b8c7a1d4f5e8b9c0d3a6f7e2b
SHA-256
input hash
HMAC-DRBG
CSPRNG
Fisher-Yates
uniform shuffle
Why SHA-256 makes the draw verifiable
SHA-256 produces a 256-bit fingerprint of the entire input set — comments, timestamp, winner count, exclusions. The hash function is collision-resistant (NIST FIPS 180-4): there is no known way to construct two different inputs that yield the same hash. So the published seed_hex is a cryptographic commitment to the exact input the algorithm ran on.
If a host swaps the winner after the draw, they must also alter the comment list — which produces a different SHA-256. Followers re-running the algorithm from the published hash will detect the mismatch instantly. Fairness becomes a mathematical property, not a promise.
seed_hex = SHA256(canonical_json({
post_url: "https://www.instagram.com/p/<shortcode>/",
comments: sorted([c.lower() for c in comments]),
timestamp: "2026-06-11T14:23:45.000Z",
winner_count: 1,
exclusions: sorted([e.lower() for e in exclusions]),
})).hex()What "fair" actually means in algorithmic terms
A fair Instagram giveaway algorithm must satisfy four properties at the same time. Drop any one and the result is no longer auditable:
- Determinism. Identical input must always yield the identical winner. Non-determinism (e.g.
Math.random()) makes the result unverifiable. - Uniformity. Every eligible comment must have exactly
1/Nprobability. HMAC-DRBG + Fisher-Yates guarantees this under the random oracle model. - Tamper-evidence.Any change to inputs must propagate to the published hash. SHA-256's avalanche property delivers this: one flipped bit changes ~50% of the output bits.
- Public auditability. Anyone, at any time, must be able to re-run the algorithm and arrive at the same winner. This requires open-source reference code + publishable inputs.
How HMAC-DRBG + Fisher-Yates produces a uniform winner
The 256-bit SHA-256 hash seeds an HMAC-DRBG instance (NIST SP 800-90A). HMAC-DRBG produces an unbounded stream of cryptographic pseudo-random bytes that is statistically indistinguishable from true randomness under standard hardness assumptions. Those bytes drive a Fisher-Yates shuffle on the sorted comment list. The first entry after applying exclusions is the winner.
drbg = HMAC_DRBG(seed=seed_hex) # NIST SP 800-90A shuffled = fisher_yates(comments, drbg) # uniform permutation winners = [c for c in shuffled if c not in exclusions][:N]
Why Fisher-Yates specifically? Because it is the only in-place shuffle that provably produces every permutation with exactly equal probability when fed a uniform RNG. Naïve sort-by-random-key shuffles are biased; Fisher-Yates is not.
How a follower verifies the winner is correct
Every Rafflecopter draw exposes the seed_hex on its result page. A skeptical follower has three independent ways to confirm the winner:
1. Use the public verifier endpoint
GET /api/verify/{seed_hex}
-> 200 { canonical_json, winner: "@ana.silveira", verified: true }2. Re-run the reference implementation
Clone the open-source reference repo and run vgp verify {seed_hex}. Byte-identical output = winner confirmed.
3. Re-compute SHA-256 yourself
Hash the canonical JSON with any SHA-256 implementation (OpenSSL, Python hashlib, browser crypto.subtle). If your digest matches the published seed_hex, the input set is authentic.
Frequently asked questions
What makes an Instagram giveaway algorithm actually fair?
A fair algorithm must be (1) deterministic — identical input always produces the same winner; (2) uniform — every eligible comment has exactly equal probability; (3) tamper-evident — any modification of inputs changes the published hash; and (4) auditable — any third party can re-run the algorithm from public inputs and verify the result.
Why is SHA-256 used instead of Math.random()?
Math.random() is non-deterministic, non-publishable, and cannot be audited after the fact. SHA-256 hashes the entire input set (comments + timestamp + exclusions) into a 256-bit fingerprint that is collision-resistant under NIST FIPS 180-4. The hash becomes the public seed — anyone can re-run the draw and arrive at the same winner.
What is HMAC-DRBG and why does it matter for giveaway fairness?
HMAC-DRBG is a NIST-approved (SP 800-90A) deterministic random bit generator. Seeded with the SHA-256 hash of the comment set, it produces a stream of cryptographically uniform pseudo-random bits used to drive the Fisher-Yates shuffle. The output is statistically indistinguishable from true randomness while remaining deterministic and reproducible.
Can the host of an Instagram giveaway cheat with this algorithm?
No. Because the algorithm publishes the SHA-256 seed hash before the winner is announced (or alongside it), any attempt to swap the winner would require the host to also alter the input comment list — which would produce a different SHA-256 hash. The mismatch is mathematically detectable by anyone who re-runs the verifier.
How can a follower verify the published winner is correct?
Each Rafflecopter draw publishes a SHA-256 seed_hex on the result page. Followers can visit /api/verify/{seed_hex}, which returns the canonical JSON input and the computed winner. Re-running the algorithm locally (open-source reference implementation is on GitHub) will yield byte-identical output. Any deviation proves tampering.
Run a verifiably fair Instagram giveaway
Paste your Instagram post URL. Rafflecopter scrapes the comments, hashes them with SHA-256, runs HMAC-DRBG + Fisher-Yates, and publishes the seed alongside the winner. No screenshots required — the math is the proof.
Used by 12,400+ creators. No login required to verify a draw.