Hash and Encryption Algorithms

Asked

Viewed 417 times

2

I’m doing a paper on the difference between Hash and Cryptography.

For me it’s easier to talk about Hash and cite examples since I usually use SHA1 and MD5, but talking about cryptography is difficult since I don’t know any encryption algorithm.

I wanted examples closer to the everyday life of the programmer, but I always end up finding only hashs and no actual encryption.

One can cite examples of encryption algorithms?

  • 2

    I believe that the question is a little broad for the format of Sopt, but of all sorts, my two cents: https://answall.com/q/43492/64969

  • 1

    When I need to see something security/encryption, I usually dig up the answers from mgibsonbr on the subject: https://answall.com/search?q=user%3A215+%5Bsegura%C3%A7a%5D

  • 1

    Some mathematical basis of a channel on YT that I really like: https://www.youtube.com/watch?v=12Q3Mrh03Gk ; https://www.youtube.com/watch?v=NOs34_-eREk ;

  • Guys, you know if Base64 is an encryption algorithm?

  • 3

    No, Base64 is just an encoding standard. If you assume that Base64 encrypts data, then using Roman numbers is encrypting decimals.

  • I get it, thank you.

Show 1 more comment

1 answer

4


According to dictionary definitions, cryptography is "a set of principles and techniques employed to encrypt the writing, make it unintelligible for those who do not have access to the combined conventions".

That is, any algorithm that makes the content unreadable or interpretable we can think, in a simple way, as encryption, or even simpler, any algorithm that "shuffles" the data.

Look at the example below, which I took from this site: http://www.henryalgus.com

var jsEncode = {
	encode: function (s, k) {
		var enc = "";
		var str = "";
		// make sure that input is string
		str = s.toString();
		for (var i = 0; i < s.length; i++) {
			// create block
			var a = s.charCodeAt(i);
			// bitwise XOR (operação lógica que "mexe" nos bits, gerando o efeito de "embaralhar" o caractere)
			var b = a ^ k;
			enc = enc + String.fromCharCode(b);
		}
		return enc;
	}
};

var chave = "123";
var e = jsEncode.encode("Teste de criptografia",chave);
console.log("dados criptografados: " + e);
var d = jsEncode.encode(e,chave);
console.log("dados descriptografados: " + d);

It’s a simple example that makes a simple encryption, a practical example close to everyday programming as you mentioned.

Hash is already a mathematical calculus, which generates a numerical representation of a given. The main feature of the hash is that it is not reversed, or "decrypted" so to speak, unlike the above example, or other commonly used algorithms such as these:

  • Symmetric key encryption: The same key is used to encrypt and decrypt the data. Among the algorithms that use this technique are DES (Data Encryption Standard), and RC (Ron’s Code or Rivest Cipher) (RC2, RC4, etc)

  • Encryption with asymmetric key, or public key. He works with two keys: a private and a public key. The public key is used to encrypt, and when sending the data to someone (or somewhere), it must send it separately to a private key, so that the data can be decrypted. Some examples are: RSA (Rivest, Shamir and Adleman) and Elgamal

Other known algorithms, mainly in Wifi networks are WEB and WPA.

References: http://pcworld.com.br/

  • Well didactic your answer. I just do not take for granted yet to move the comments. :)

  • Yes, the more comments and answers the better for the community :)

  • This example is encryption with symmetric key, ne?

  • 1

    The dictionary definition is not very technical. And it would be better to put an E in place of the OU, because Base64 is not encryption and many think it is. It is interpretable, although unreadable.

  • 1

    I even voted for the answer, but I’m not a fan because you ask for an example without any criteria, it’s a "put something there".

  • 1

    WEP and WPA in the case?

  • 1

    "Dictionary definition is not very technical" yes @Maniero, you’re right, but the intention was exactly this case :) javascript which includes

Show 2 more comments

Browser other questions tagged

You are not signed in. Login or sign up in order to post.