| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -28,15 +28,11 @@ Sometimes we want to create a badge for a story, but don't want the world to kno | |||
| 28 | 28 | ||
| 29 | 29 | To link a badge to a secret tag: | |
| 30 | 30 | ||
| 31 | - 1. Install `pwgen`, a random string generator. Mac users can install this using Homebrew: `brew install pwgen` | ||
| 32 | - 2. Generate a bunch of random strings: `pwgen -n -y 20`. Copy one of them to the clipboard. This will be the salt. | ||
| 33 | - 3. From the command line, run `sbt`. Inside `sbt` run `console` | ||
| 34 | - 4. From the console run: `import java.security.MessageDigest` | ||
| 35 | - 5. From the console run: `import java.math.BigInteger` | ||
| 36 | - 6. From the console run: `val input = "[salt from the clipboard]" + "your/secret/tag"` | ||
| 37 | - 7. From the console run: `val digest = MessageDigest.getInstance("MD5")` | ||
| 38 | - 8. From the console run: `digest.update(input.getBytes(), 0, input.length)` | ||
| 39 | - 9. From the console run: `new BigInteger(1, digest.digest()).toString(16)` | ||
| 40 | - 10. The result of the last step is your encrypted tag | ||
| 41 | - 11. In the `Badges` object, add a new val: `val specialReport = SpecialBadge("[salt]", "[encrypted tag]", Static("path/to/Badge.svg"))` | ||
| 42 | - 12. In CODE create an article with your new tag and ensure the badge is applied correctly | ||
| 31 | + 1. Run `sbt "badgeHash [your tag]`" | ||
| 32 | + 2. The output looks like | ||
| 33 | + ``` | ||
| 34 | + salt=XXXXXXXXX | ||
| 35 | + hash=XXXXXXXXX | ||
| 36 | + ``` | ||
| 37 | + 3. In the `Badges` object, add a new val: `val specialReport = SpecialBadge("[salt]", "[hashed tag]", Static("path/to/Badge.svg"))` | ||
| 38 | + 4. In CODE create an article with your new tag and ensure the badge is applied correctly | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments