Rabin Cryptosystem Technique Implementation in C

The Rabin cryptosystem is an asymmetric cryptographic technique, whose security, like that of RSA, is related to the difficulty of factorization. However the Rabin cryptosystem has the advantage that the problem on which it relies has been proved to be as hard as integer factorization, which is not currently known to be true of the RSA problem.


Rabin cryptosystem has the disadvantage that each output of the Rabin function can be generated by any of four possible inputs; if each output is a ciphertext, extra complexity is required on decryption to identify which of the four possible inputs was the true plaintext.

This article do not cover algorithm behind the Rabin cryptosystem. We suggest to go through very simple explanation given on Wikipedia for detailed explanation on Key generation, Encryption and Decryption.

Following is the implementation of the Rabin cryptosystem in C.


Download   Run Code


p = 383, q = 59, n = 22597

PlainText is 12419
Cipher Text is 7036

P1 = 10944
P2 = 10178
P3 = 12419
P4 = 11653

1 Star2 Stars3 Stars4 Stars5 Stars (1 votes, average: 5.00 out of 5)


Thanks for reading.

Please use our online compiler to post code in comments. To contribute, get in touch with us.
Like us? Please spread the word and help us grow. Happy coding 🙂

Leave a Reply

Notify of