ryptography is the science of transforming messages so that the meaning is hidden (encryption) and recovering the hidden meaning from transformed messages (decryption). A transformed message, in which the meaning is hidden, is called cipher text, while the non-transformed or recovered message, in which the meaning is not hidden, is called plain text. There are many methods of reversible transformation suitable for encryption/decryption applications.
Most modern cryptographic methods treat messages as a sequence of characters represented numerically. These are transformed through mathematical algorithms, involving the use of one or more "keys." A key is a number or group of numbers that, used in a transformation algorithm, transform or restore the numbers that represent the characters of a message. Symmetric cryptographic transformations use the same key for encryption and decryption. The process is therefore described as "symmetrical." Asymmetric cryptography, on the other hand, uses different but mathematically related keys for encryption and decryption.
In asymmetric cryptography, the key that is used to encrypt messages can be freely distributed via any non-secure medium, or a public key. Thus, asymmetric cryptography is also referred to as public key cryptography. However, messages encrypted with the public key cannot be decrypted using the public key. Public key encrypted messages can only be decrypted using the corresponding private key which is kept secure. Adding to the confusion, messages encrypted using the private key can only be decrypted using the corresponding public key. Encryption and decryption are very useful tools. However, these tools alone cannot address all secure messaging concerns. For example, since public keys are public, anyone can encrypt messages that decrypt with a private key. It would be very easy for an imposter to encrypt a message and claim to be someone you trust. Furthermore, it is possible for someone familiar with the public key cryptography algorithms to alter an encrypted message in an undetectable manner. This altered message could involve inserting, deleting, or replacing part of the original message.
You can alleviate these concerns by using a message hash in conjunction with public key encryption and decryption. A message hash is a digest of a message. Hashing algorithms process a message of any length into a fixed length hash. These algorithms are designed so that even very minor alterations to the messagesuch as inserting, deleting or changing a single characterresults in a very different hash result.