Problem 44959. RSA encryption using public key
Encrypt the message text by converting to uint8 matrix using UTF-8 representation. Convert uint8 matrix to a large integer string. Use RSA encryption on the integer string given the public keys (n and e) and output the encrypted integer string. The public key (e) will always be fixed at 65537. No hashing or padding of the message is done.
For example:
message = 'I like to swim!';%given as input integer_String = '379695297047669462525290688599911713';%calculated n='418336393847020647250825879743341651032293545176800777981294580200903315345456262337972725306797613061';%given as input e= 65537;%fixed output_String = '158037161019988039882393476857386648994978438821991287680442802412825849535544067751541256843540494019';%output
Solution Stats
Problem Comments
-
3 Comments
Sorry, but I don't understand your instruction to "convert the uint8 array to a long integer string". Could you be more specific?
Convert byte array into an integer/biginteger
A better answer to William (and for people that don't use Java) would be that after converting numbers to uint8, we must transform a vector into a single number using base 256. That means that a word like 'ball' becomes [98, 97, 108, 108] and then 98*256^3 + 97*256^2 + 108*256 + 108 = 1650551916.
Solution Comments
Show commentsGroup

Advanced Cryptography Algorithms and Mathematics
- 21 Problems
- 0 Finishers
- Determine RSA keys (public and private) given two prime number character strings (p and q)
- Create State Array for initiating SHA-3-224 Hash
- RSA encryption using public key
- RSA decryption
- Mask Generation Function (MGF1) for PKCS #1 Standard utilizing Optimal Asymmetric Encryption Padding for RSA Cryptography
- Optimal Asymmetric Encryption Padding of message for RSA Cryptography
- Optimal Asymmetric Encryption Padding decoding of message for RSA Cryptography
- Find R*Rp-N*Np=1 given gcd(R,N)=1
- Montgomery Reduction Algorithm (REDC)
- Inverse Number Theoretic Transform (iNTT)
- Number Theoretic Transform (NTT)
- Montgomery Multiplication
- Output the Montgomery Form of the Input Matrix
- RIPEMD160 Hash
- SHA256 Hashing
- Binary Array to Hex Representation
- String to Binary Representation
- AES-256 KeyExpansion()
- AES SubBytes() Transformation
- Elliptic Curve Cryptography (ECC) Point Addition
- Obtain the Bitcoin address associated to a given private key
Problem Recent Solvers6
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!