Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

237
Views
Convierta la función a javascript, llamando desde c ++ al servidor node.js - cifrado

Estoy tratando de encriptar una cadena usando el framework juce generatekeypair, esto crea un par de claves RSA y lo divide en 2 partes (y lo pone en formato hexadecimal, creo).

Este es el código de trabajo que estoy usando en C++:

 const juce::String encryptString (const juce::String& str) { juce::RSAKey private_key2 ("thisistheprivatekeypart1,thisistheprivatekeypart2"); auto utf8 = str.toUTF8(); auto* utf8Address = utf8.getAddress(); juce::MemoryBlock plainMemoryBlock(utf8Address, utf8.sizeInBytes()); juce::BigInteger sourceInteger; sourceInteger.loadFromMemoryBlock(plainMemoryBlock); if (!sourceInteger.isZero()) { juce::BigInteger encodedInteger(sourceInteger); private_key2.applyToValue(encodedInteger); juce::MemoryBlock encodedMemoryBlock = encodedInteger.toMemoryBlock(); return encodedMemoryBlock.toBase64Encoding(); } return {}; }

Ahora estoy dando mis primeros pasos en node.js, configuré con éxito un servidor que toma y envía parámetros, ¿alguien sabe cómo escribir esta función en node.js?

En el sitio web de juce tienen este fragmento de Java no confirmado, pero no me está ayudando mucho:

 public class RSAKey { static BigInteger applyToValue (BigInteger value, String key_part1, String key_part2) { BigInteger result = BigInteger.ZERO; BigInteger part1 = new BigInteger (key_part1, 16); BigInteger part2 = new BigInteger (key_part2, 16); if (part1.equals (BigInteger.ZERO) || part2.equals (BigInteger.ZERO) || value.compareTo (BigInteger.ZERO) <= 0) return result; while (! value.equals (BigInteger.ZERO)) { result = result.multiply (part2); BigInteger[] div = value.divideAndRemainder (part2); value = div[0]; result = result.add (div[1].modPow (part1, part2)); } return result; } }
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!