bio/template/hide.html

29 lines
746 B
HTML
Raw Normal View History

<script>
function unhide(seed, arr) {
seed %= 1000000007;
const str_arr = [];
for (let i = 0; i < arr.length; i++) {
str_arr.push((((arr[i] - seed) % 256) + 256) % 256)
seed = seed * seed % 1000000007;
}
const ui8_arr = new Uint8Array(str_arr);
const str = new TextDecoder().decode(ui8_arr);
return str;
}
function unhide_permalink() {
let anchors = document.querySelectorAll("a[hidden_permalink][seed]")
for (let anchor of anchors) {
let arr = new Array();
for (let n of anchor.getAttribute("hidden_permalink").split(",")) {
arr.push(Number(n));
};
let seed = Number(anchor.getAttribute("seed"))
anchor.href = unhide(seed, arr);
}
}
</script>