What is a digital signature ?
Like a signature, a digital signature allows to authenticate the emitter of the message and verify the message has not been modified since it has been signed. How does the digital signature work ?
The emitter of the message computes the hash of the message (cf post on hash functions) and encrypts the hash with his private key (cf post on asymmetric cryptography).
To verify the signature, the receiver has to:
Decrypt the digital signature with the public key of the emitter; he will then obtain the hash function of the message, computed by the emitter,
Compute the hash of the message,
Compare the two hashes; if the two hashes are equal, it means the message has not been altered and the message is coming from the owner of the public key he used to decrypt the signature.