import { MD5 , AES , enc } from "crypto-js" ; function generatePasswordSaveEncriptionKeyV0 ( worldPassNumber , checkOriginalMapString ) { return `^ /${ worldPassNumber * 231 + 8310 + checkOriginalMapString }P+>A[]` ; } function generatePasswordSaveEncryptionKeyV1 ( worldPassNumber ) { return `^ /${ worldPassNumber * 231 + 8310 }P+>A[]` ; } export function encodeSaveData ( saveData , worldPassNumber ) { console . warn ( enc . Utf8 . parse ( saveData ) ) ; return AES . encrypt ( enc . Utf8 . parse ( saveData ) , generatePasswordSaveEncryptionKeyV1 ( worldPassNumber ) ) . toString ( ) ; } export function decodeSaveDataV0 ( password , worldPassNumber , checkOriginalMapString ) { return AES . decrypt ( password , generatePasswordSaveEncriptionKeyV0 ( worldPassNumber , checkOriginalMapString ) ) . toString ( enc . Utf8 ) ; } export function decodeSaveDataV1 ( password , worldPassNumber ) { return AES . decrypt ( password , generatePasswordSaveEncryptionKeyV1 ( worldPassNumber ) ) . toString ( enc . Utf8 ) ; } export function generateMD5 ( text ) { return MD5 ( text ) . toString ( ) ; }