Skip to content

Instantly share code, notes, and snippets.

@jongan69
Last active May 29, 2024 23:36
Show Gist options
  • Save jongan69/649d1625b6d06cc5f94f5c6b6835a210 to your computer and use it in GitHub Desktop.
Save jongan69/649d1625b6d06cc5f94f5c6b6835a210 to your computer and use it in GitHub Desktop.
Runemilio Jazz
// Function to pad a given key to a length of 32 bytes using the CryptoJS library
function padKey(e) {
// Convert the input string 'e' to a UTF-8 encoded WordArray
let t = CryptoJS.enc.Utf8.parse(e);
// Create an empty WordArray to store the padded key
let n = CryptoJS.lib.WordArray.create();
// Concatenate the UTF-8 encoded WordArray 't' to 'n'
n.concat(t);
// Loop until the length of 'n' in bytes is less than 32
while (n.sigBytes < 32) {
// Concatenate a WordArray containing a single 0 to 'n'
n.concat(CryptoJS.lib.WordArray.create([0]));
// Ensure the byte length does not exceed 32
n.sigBytes = Math.min(n.sigBytes + 4, 32);
}
// Explicitly set the length of 'n' to 32 bytes
n.sigBytes = 32;
// Return the padded key
return n;
}
// Function to decrypt content using AES with the provided encrypted data, key, and IV (initialization vector)
function decryptContent(e, t, n) {
// Creates a padded key from the provided key 't' using the padKey function
const o = padKey(t);
// Creates a CipherParams object with the ciphertext parsed from the hexadecimal string 'e'
const a = CryptoJS.lib.CipherParams.create({
ciphertext: CryptoJS.enc.Hex.parse(e)
});
// Decrypts the ciphertext using AES with the padded key 'o', the CBC mode, and PKCS7 padding
// The IV is parsed from the hexadecimal string 'n'
const decrypted = CryptoJS.AES.decrypt(a, o, {
mode: CryptoJS.mode.CBC,
padding: CryptoJS.pad.Pkcs7,
iv: CryptoJS.enc.Hex.parse(n)
});
// Converts the decrypted WordArray to a UTF-8 string and returns it
return decrypted.toString(CryptoJS.enc.Utf8);
}
// Asynchronous function to retrieve and decrypt a series of encrypted text files
async function grabEncryptedTxt(e) {
try {
// Fetches the list of whitepaper resource IDs
const t = await fetchChildren(pids.whitePaper);
// Fetches the list of whitepaper hash IDs
const n = await fetchChildren(pids.whitePaperHashes);
// Ensures the fetched whitepaper list has IDs
t.ids.length;
// Initializes an array to hold the decrypted content
let o = [];
// Sets the initial decryption key to the input parameter 'e'
let a = e;
// Iterates over the whitepaper IDs in reverse order
for (let e = t.ids.length - 1; e >= 0; e--) {
const r = t.ids[e]; // Current whitepaper ID
// Fetches and decrypts the current whitepaper resource
const i = decryptContent(
await fetchResource(`${bu}${r}`, "text", "Failed to fetch whitepaper"), // Fetches the resource and handles errors
a, // Current decryption key
"00000000000000000000000000000000" // IV (initialization vector) set to a fixed value
);
// If decryption fails, throws an error
if (!i)
throw new Error(`Decryption failed for whitepaper at index ${e}`);
// Adds the decrypted content to the array
o.push(i);
// Updates the decryption key for the next iteration, if not the last item
if (e > 0) {
const t = n.ids[e - 1]; // Next hash ID
// Fetches the next decryption key from the hash resource
a = await fetchResource(`${bu}${t}`, "text", "Failed to fetch hash inscription");
}
}
// Reverses the order of the decrypted content to match the original order
o = o.reverse();
// Returns the array of decrypted content
return o;
} catch (e) {
// Logs the error to the console and returns an empty array in case of failure
console.error(e);
return [];
}
}
<!DOCTYPE html>
<html lang="en">
<body>
</body>
<script
data-w="/zipfFCycU1XQbratDNXRw==:nkqgntAFcEomsIjuGu2XCKiAHA+k+723dqgRP/DAxamqEsx+Nwvyv83eVP4Pdvy5RGMpDalluwT+3vzQv5IsBO/+/8rP2tZlmuCrLVZfqlg="
src="/content/c6419e633534492918ee42cdfcc06385c0e8549d085f5b5232dec0478b451d61i0"></script>
<script src="/content/c2a9964ebec2aeaa3d5963cfd6c679d1bcd0328aabb078e18eb4532003e1f38ai0"></script>
<script>
// Injected Script Tag
async function handleScriptLoad(a) {
// prints some shit
const bu = '/content/';
const t = await fetchChildren(pids.whitePaper);
const n = await fetchChildren(pids.whitePaperHashes);
console.log('whitePaper is: ', t);
console.log('whitePaperHashes is: ', n);
// Main internals of grabEncryptedTxt Function
let o = []
for (let e = t.ids.length - 1; e >= 0; e--) {
// inscription decryption iv id
const r = t.ids[e];
const hex = await fetchResource(`${bu}${r}`, "text", "Failed to fetch whitepaper");
console.log('inscription iv hex for cipher: ', hex)
const a2 = CryptoJS.lib.CipherParams.create({
ciphertext: CryptoJS.enc.Hex.parse(hex)
})
console.log('inscription iv cipher text for decrypt: ', a2)
const key = CryptoJS.enc.Hex.parse("d27c2505c2bffebcbbb708d153c671f7d0787d1df81aa44171d1798fc3f2c115");
console.log('hex key for decrypt: ', key)
const paddedKey = padKey("d27c2505c2bffebcbbb708d153c671f7d0787d1df81aa44171d1798fc3f2c115")
console.log('padded value example : ', paddedKey)
console.log('walletInfo: ', walletInfo.split(":"))
const walletEncode = CryptoJS.enc.Base64.parse(walletInfo.split(":")[1]);
const d = CryptoJS.enc.Base64.parse("7a6f9789dfbfc1bc4e83a675a7f39728");
console.log('d: ', d)
const u = CryptoJS.AES.decrypt({
ciphertext: a2
},
key,
{
iv: walletEncode,
mode: CryptoJS.mode.CBC,
padding: CryptoJS.pad.Pkcs7
});
console.log('decrypted key: ', u)
const i = decryptContent(await fetchResource(`${bu}${r}`, "text", "Failed to fetch whitepaper"), a, "00000000000000000000000000000000");
console.log('i: ', i);
if (!i)
throw new Error(`Decryption failed for whitepaper at index ${e}`);
if (o.push(i),
e > 0) {
const t = n.ids[e - 1];
a = await fetchResource(`${bu}${t}`, "text", "Failed to fetch hash inscription")
}
}
console.log('o is: ', o.reverse());
}
</script>
<script async src="/content/ff15378a8387eb74166fa25abea29c430b9b2c00e90ad05bcb2a33363d9900c5i0" onload='handleScriptLoad("mySecretPasscode")'></script>
</html>
@jongan69
Copy link
Author

Notifications Inscriptions:

https://ordiscan.com/inscription/70632436

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment