DEV Community

Cover image for What is cryptography and how it is used in the cryptocurrency world?
alexhayes24
alexhayes24

Posted on • Edited on

What is cryptography and how it is used in the cryptocurrency world?

Traditionally, cryptography is known as a process of encoding private messages so that third parties do not recognize the content. Cryptography was very popular in the oldest times when the wars between ancient tribes and states occurred and human messengers were responsible for delivering important notes. If the enemy would find out the information written in the note, this could turn around the result of the war and the whole history ahead.

For example, Julius Caesar was known for creating his own cipher. The principle of this cipher was very simple, yet showing the essence of what cryptography is. He was replacing each letter with the 4th consecutive letter after the actually meant one in an alphabet and putting everything in one string so that the separate words would not be recognizable. This way of encoding information back in the days of Caesar turned out to be effective and there are no recorded leaks of the secret Julius’s messages known to historians.

Today, the technology and complexity of everything have gone far. You can insert a bitcoin price widget with HTML code on your own site when Julius Caesar wouldn’t even know half of the words in this sentence. In the digital era that we’re living in today, cryptography became especially important for privacy reasons. Private information in the form of personal bank accounts, transactions, and other sensitive data is being transferred through international networks with a lot of intermediaries. Thus, it’s crucial to have a secure way of storing and transmitting this type of data.
What is modern cryptography?
Cryptography is widely used today in the digital communication field for maintaining the privacy of personal data, secured transactions, digital signatures, storing and authenticating login and password combinations. Most of the protocols are shared between numerous organizations thus creating a standard for security. At the same time, the most popular algorithms are the ones that hackers try to breach the most frequently. Some organizations, including governmental offices, even have crypto intelligence departments that work specifically in an attempt to find the so-called “collisions” that allow them to violate confidentiality and steal the data. When the collision is found, they can create the necessary protection.

One of such cases was the fault in the SHA-1 hashing function found by Google employees. The corporation was trying to break this function for two years, presumably spending 6,500 years of CPU computational time. As a result, they found the flaw, in which SHA-1 couldn’t recognize the difference in bits of two different files, thus creating the same hash value for them. This invention led to the global reconsideration of the hashing algorithms in the favor of newer versions of SHA.

The most widespread crypto security protocols:

SSL/TLS
AES
RSA
ECC
PGP
S/MIME

SSL and TLS, just like most of the cryptographic algorithms occurring between the server and the client, use the series of digital “handshakes” meaning the exchange of ciphered codes which can be sent to the public key of the parties and deciphered only by their respective private keys. The deciphered result should correspond with the value established as true and then approved. As a result of this approval, the client-server pair creates a symmetrical session key which is used for authentication.

PGP, created somewhere around 1991, is still widely used by companies around the world, even giants like Gmail and Mac Mail. The problem with this type of encryption is that it is proved to have some security vulnerabilities and implementation issues. Security experts recommend going to your email settings and adjusting another layer of encryption called S/MIME, which encrypts your email data not just during the sending and receiving but also during the storage.

Elliptic curve cryptography is said to have some prominent advantages in relation to RSA as it is built on the algebraic configuration of elliptical curves in limited fields. It will presumably reshape the future of the SSL certificate and its successor TLS making them even safer.
The use of cryptography in cryptocurrencies
If you’re new to cryptography, then cryptocurrencies might seem to be like harbingers of a brand new era in technology. However, they are built on the good old asymmetric cryptography and hashing function. Meaning that basically, they are encrypted the same way as your credit card number when you’re shopping online or your email when you send it to a friend.

Asymmetric cryptography is the set of protocols that deal with public and private keys - the same goes for any bitcoin wallet out there. When you want to either buy or sell it, you’re using your and the other party’s public keys for declaring the transaction. After it’s approved, all you have to do is decrypt it with your private keys.

The hashing function comes into play when miners collect some amount of transaction and try to write it into the entire blockchain by creating a new block. To do that, every miner receives the personal computational task that they are trying to solve (it’s not like all the miners are trying to solve the same mathematical problem). The difficulty lies in the fact that they are trying to essentially guess the random value, which will become the future hash of this new block. If the miner is late and the other block is being written in the 10-minutes range into the parent block, then they are late and have to solve a new task.

The initial value, which is being encrypted, i.e. the stack of transactions stays the same during each mining trial. Now things get dirty. As you might know, the same input value always creates the same output hash. So, how can miners calculate billions of hash options within seconds of time if each time they have the same input? The thing is that every time they change the tiny part of the block information called the nonce. And, with such an amount of zeros as the bitcoin difficulty level suggests, it’s extremely hard to pick the random value of this range. Hard not in terms of advanced maths, but in terms of the number of tries, also known as the brute force algorithm. In other words, the exhaustive search.

Once the trial is successful and the block is created, it’s up for another challenge - digital signatures of the rest of the network, which validate it based on the other hashes written in the history of the blockchain. Now we’re again facing the “handshakes” of asymmetric cryptography but on a global scale with who-knows-how-many servers doing it around the world at the same time. Hacking this kind of system would be tough to do even having some sort of super-computers at hand. Indeed, the beauty of the blockchain is not about the breakthrough technology but about how it’s organized.

Top comments (1)

Collapse
 
patriciavegasenecaniaga profile image
patriciavegasenecaniaga

Online cryptocurrency gaming has skyrocketed in recent years. The well-known crypto casino sites provide betting on a wide range of topics, including politics and sports. Moreover, these gaming websites now provide users additional chances to play and new methods to get cryptocurrency. Online payments using cryptocurrencies like Bitcoin, Ether, Litecoin, and Ripple are quickly overtaking other payment methods. Many cryptocurrency casinos can be found online, each with its own set of games and possibilities to win Bitcoins or other cryptocurrencies. Visit for more information about the BC game crypto senecaniagaracasino.ca/ casino that I want to discuss with you. These games include poker, roulette, slots, and other games. Several of these are classic table games where participants gather around a table to compete against the house. Others let you place a bet using both digital and fiat money, or even a combination of the two. In general, gambling is a rather straightforward activity. The player first conducts an online transaction using their chosen currency. The website's owner or operator then submits an offer that contains information about the game and the amount they are prepared to pay winners. Every level of the game, including the entrance cost and the ultimate price, offers players a chance to win. Typically, Bitcoin, Ether, or a comparable cryptocurrency is used to pay out the winnings.