From 1115e5c2594aa103701539e3c4842b649cea0003 Mon Sep 17 00:00:00 2001 From: ReznoRMichael Date: Sat, 23 Jan 2021 12:01:20 +0100 Subject: [PATCH] cleaning, docs --- js/LoadSaveFile.js | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/js/LoadSaveFile.js b/js/LoadSaveFile.js index 8c2e5a5..20aadb0 100644 --- a/js/LoadSaveFile.js +++ b/js/LoadSaveFile.js @@ -1,23 +1,18 @@ +/* + Parts of the code thanks to bloodorca https://github.com/bloodorca/hollow (base64.js, functions.js) with slight modifications. + The steps used there for decryption were taken from KayDeeTee https://github.com/KayDeeTee/Hollow-Knight-SaveManager +*/ + const CSHARP_HEADER = [0, 1, 0, 0, 0, 255, 255, 255, 255, 1, 0, 0, 0, 0, 0, 0, 0, 6, 1, 0, 0, 0]; // 22 bytes const BASE64_ARRAY = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".split("").map(c => c.charCodeAt(0)); const BASE64_DECODE_TABLE = new Map(BASE64_ARRAY.map((ord, i) => [ord, i])); -const AES_KEY = new TextEncoder().encode('UKu52ePUBwetZ9wNX88o54dnfKRu0T1l'); // encodes to Uint8Array -const ECB_STREAM_CIPHER = new aesjs.ModeOfOperation.ecb(AES_KEY); // create a new AES stream cipher object +const AES_KEY = new TextEncoder().encode('UKu52ePUBwetZ9wNX88o54dnfKRu0T1l'); // encodes a string to Uint8Array (prepare for AES JS) +const ECB_STREAM_CIPHER = new aesjs.ModeOfOperation.ecb(AES_KEY); // create a new AES stream cipher object using the encoded key let bench = { begin: 0, end: 0 }; -// console.log(`AES_KEY: ${AES_KEY}`); -// console.log(`ECB_STREAM_CIPHER: ${ECB_STREAM_CIPHER}`); - -function ShowFile(input) { - let inputFileObject = input.files[0]; - - alert(`File name: ${inputFileObject.name}`); - alert(`Last modified: ${inputFileObject.lastModified}`); -} - // main input tag file function function LoadSaveFile(input) { // start benchmark