Can one time pad cipher implemented for numbers? if yes, can you tell me the algorithm or the working code (preferably java) for the same?
Also, what is the difference between one time pad and xor cipher.
Can one time pad cipher implemented for numbers? if yes, can you tell me the algorithm or the working code (preferably java) for the same?
Also, what is the difference between one time pad and xor cipher.
OTP and what you describe as xor cipher are the same if (and only if) the following assumptions are true:
those are some pretty heavy assumptions
for example, if you want to encrypt a DVD, your key will also be as large as one DVD, which has to be securely transferred to the recipient, also that key DVD may only be used for this single data exchange and may never be reused
you may not simply create the random bits by using the random class ... OTP demands TRUE randomness ... no pseudo random number generator... not even a cryptographically secure one... the OTP definition asks for true random values ... why not even a CSPRNG? because the strength of OTP is being unbreakable ... as soon as you rely on something less than a true random source, the overall cryptographic strength goes down from infinite to the cryptographic strength of the CSPRNG ... which may be a cryptographic strength that is quite good, but finite ... it might be possible to break it... for real OTP, it has been prooven that even with infinite resources, the system is not breakable from the information theory side, which is remarkable, because it is the ONLY known cryptosystem with this property
OTP usually is impracticable for our usual day to day cryptographic applications, and usually only employed when you are dealing with exceptional situations, like communication between a spy and the secret agency he/she works for...
the algorithm itself is well known ...
have a key that holds true for all assumptions above
bitwise xor with the plaintext
done