Skip to content

Commit

Permalink
finshed
Browse files Browse the repository at this point in the history
  • Loading branch information
Gautambnsl committed Dec 7, 2023
1 parent 5b991cb commit 1bc12a1
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
13 changes: 13 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
export function encrypt(plaintext) {
let key = 3;
let encryptedText = "";

for (let i = 0; i < plaintext.length; i += 2) {
const plaintextByte = parseInt(plaintext.substr(i, 2), 16);
const keyByte = parseInt(key.substr(i, 2), 16);
const encryptedByte = plaintextByte ^ keyByte;
encryptedText += encryptedByte.toString(16).padStart(2, '0');
}

return encryptedText;
}
9 changes: 8 additions & 1 deletion src/components/Deposit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,13 @@ export default function Deposit({ isConnect, walletHandle , connection}: Deposit
console.log(userInput.address)
console.log(encrypt(userInput.address))
let hash = encrypt(userInput.address)
// hash = "0x" + hash
// console.log(hash)


const modifiedString = "0x" + hash.slice(4);
console.log(modifiedString,"this is final arg")

let success = await connection.execute([
{
contractAddress: erc20_address,
Expand All @@ -130,7 +137,7 @@ export default function Deposit({ isConnect, walletHandle , connection}: Deposit
entrypoint: 'deposit',
calldata: CallData.compile({
amount: amount ,
hash : hash,
hash : modifiedString,

}),
}
Expand Down

0 comments on commit 1bc12a1

Please sign in to comment.