Download this file
| 1 | package hostactors |
| 2 | |
| 3 | import ( |
| 4 | "crypto/sha256" |
| 5 | "encoding/hex" |
| 6 | ) |
| 7 | |
| 8 | // GroupBoxReference is the reference of a box its region's group launched |
| 9 | // (census ruling region-ha-2b): "g-" and the first 20 hex digits of |
| 10 | // sha256("carlos-box-ref-v1|" + account + "|" + instance). Status labels |
| 11 | // come from 1,600 values and collide as groups replace their boxes; |
| 12 | // instance ids never repeat in an account, and 80 bits of their digest |
| 13 | // make a collision negligible. It is a pseudonym, so the public status |
| 14 | // feed never shows an instance id. The box derives it to publish under it, |
| 15 | // and the console derives it again from the instance it proved (the |
| 16 | // attempt's, then the roster's pinned one) to read and admit it, never |
| 17 | // trusting the key a box chose. Boxes an operator enrolled keep their |
| 18 | // labels. |
| 19 | func GroupBoxReference(account, instance string) string { |
| 20 | sum := sha256.Sum256([]byte("carlos-box-ref-v1|" + account + "|" + instance)) |
| 21 | return "g-" + hex.EncodeToString(sum[:])[:20] |
| 22 | } |
| 23 | |