Encrypt a String for RC2 in Javascript

Asked

Viewed 913 times

0

There is a way to use RC2 encryption through some Javascript function?

I’m making a mobile application where her validation token needs to be through this encryption because the rest of the system already uses it.

EDITED

Through a comment below (made by @Omni), I found the Cryptojs library where it encrypts to RC2. o Problem is that the result it returns to me I cannot handle the same for a binary string. I have the following values:

<script src="https://rawgithub.com/tomyun/crypto-js/xeit-3.1.2/build/rollups/rc2.js"></script>
<script>
    var VALUE = "29udbAj%(y4";
    var KEY = "M^$UCLThSEZGnet";
    var KEYSIZE= 64;

    var e = CryptoJS.RC2.encrypt(VALUE,KEY,{effectiveKeyBits: KEYSIZE});
    var d = CryptoJS.RC2.decrypt(e,KEY, {effectiveKeyBits: KEYSIZE});
    /*
        preciso retornar o resultado = '95817E9B4F230CD37EB564BD13BB568F'
    */
</script>

how do I get to the above result?

  • 2

    How about using this library?

  • I’m studying this to Cryptojs, but I’m not getting the result I’m looking for...

  • 1

    You should then ask your question what you have already tried, what you have used and what difficulties you have encountered in getting help and not making repeated suggestions (for example, what is your problem with Cryptojs?)

  • @Omni put the data I need to return, in the issue of the question. could help me please?

  • 1

    From what I understand your problem is no longer encryption, but converting encrypted text to hexadecimal?

  • probably yes, I have never worked with cryptography before, the sector that is doing my webservice needs me to send a variable with the value of the result so that it can validate my AJAX requests. and the Value variable is the key of each application.

Show 2 more comments
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.