Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (function() {
- const E = 65537n;
- const N = 1000000000100000000002379n;
- const D = 773700352548471672492113n;
- function pow_mod(base, exp, mod) {
- let n = 1n;
- while(exp > 0n) {
- if(exp % 2n === 1n) {
- n *= base;
- exp -= 1n;
- }
- base = base ** 2n % mod;
- exp /= 2n;
- n %= mod;
- }
- return n;
- }
- function crack(cyphertext, d, e, n) {
- let start_plain = cyphertext.substring(0, 30);
- let rest_cypher = cyphertext.substring(30);
- let rest_plain = rest_cypher
- // Text pre-processing to strip interwoven words and concatenate and parse lines
- .split("\n").map(line => line.split(" ").filter((_, i) => i % 2 == 0).join("")).map(n => BigInt(n))
- // Decrypting using `d`
- .map(x => pow_mod(x, d, n))
- // Converting the decrypted numbers to ASCII
- .map(n => n.toString().padStart(3 * 8, "0").match(/.{3}/g).map(n => String.fromCharCode(parseInt(n))).join("")).join("");
- return start_plain + rest_plain;
- }
- for(let comment of document.querySelectorAll("ytd-comment-thread-renderer #content-text")) {
- if(/^(.|\n){30}((\d{3}\s+\w+\s*){8}\n?)+$/g.test(comment.innerText)) {
- comment.innerText = `DECRYPTED: [[[ ${crack(comment.innerText, D, E, N)} ]]]`;
- }
- else if(/(\b\d{3}\b.*){8}/g.test(comment.innerText) && !/^FAILED TO DECRYPT \(invalid format\): \[\[\[ (.|\n)* \]\]\]$/g.test(comment.innerText)) {
- comment.innerText = `FAILED TO DECRYPT (invalid format): [[[ ${comment.innerText} ]]]`;
- }
- }
- })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement