Blockchain - Elliptic Curve Cryptography - GeeksforGeeks (2024)

Skip to content

Blockchain - Elliptic Curve Cryptography - GeeksforGeeks (1)

Last Updated : 17 Nov, 2022

Summarize

Comments

Improve

Suggest changes

Like Article

Like

Save

Report

Cryptography is the study of techniques for secure communication in the presence of adversarial behavior. Encryption uses an algorithm to encrypt data and a secret key to decrypt it. There are 2 types of encryption:

  1. Symmetric-key Encryption (secret key encryption): Symmetric-key algorithms are cryptographic algorithms that employ the same cryptographic keys both for plaintext encryption and ciphertext decoding. The keys could be identical, or there could be a simple transition between them.
  2. Asymmetric-key encryption (public key encryption): Asymmetric-key algorithms encrypt and decrypt a message using a pair of related keys (one public key and one private key) and safeguard it from unauthorized access or usage.

The following topics of Elliptic Curve Cryptography will be discussed here:

  1. Introduction to Elliptic Curve Cryptography
  2. History of Elliptic Curve Cryptography
  3. Components of Elliptic Curve Cryptography
  4. Elliptic Curve Cryptography Algorithms
  5. Application of Elliptic Curve Cryptography
  6. ECC vs RSA
  7. Elliptic Curve Diffie-Hellman Protocol Implementation
  8. Types of Security Attacks
  9. Benefits of Elliptic Curve Cryptography
  10. Limitations of Elliptic Curve Cryptography
  11. Conclusion

Introduction to Elliptic Curve Cryptography

ECC, as the name implies, is an asymmetric encryption algorithm that employs the algebraic architecture of elliptic curves with finite fields.

  • Elliptic Curve Cryptography (ECC) is an encryption technology comparable to RSA that enables public-key encryption.
  • While RSA’s security is dependent on huge prime numbers, ECC leverages the mathematical theory of elliptic curves to achieve the same level of security with considerably smaller keys.
  • Victor Miller and Neal Koblitz separately proposed elliptic curve ciphers in the mid-1980s. On a high level, they are analogs of actual public cryptosystems in which modular arithmetic is substituted by elliptic curve operations.

History of Elliptic Curve Cryptography

  • Neal Koblitz and Victor S. Miller independently proposed the use of elliptic curves in encryption in 1985.
  • Elliptic curve cryptography algorithms entered wide use from 2004 to 2005.
  • In the mid-1980s, researchers found that examining elliptic curves could lead to the discovery of new sources of difficult problems. Elliptic Curve Cryptography (ECC) introduced a new degree of security to public key cryptosystems, that provide combined encryption and digital signature services.
  • The security of elliptic curve cryptosystems, like that of all public-key cryptosystems, is based on tough mathematical issues at the core. Given two elliptic curve points G and Y, where Y = kG.
  • The term “elliptic curve” is derived from the ellipse. Elliptic curves were discovered in the form of the Diophantine equationfor c, after the 17th century. Furthermore, while calculating the surface of the ellipse is simple, calculating the circumference of the ellipse is difficult. The equation can be simplified to an integral:

Components of Elliptic Curve Cryptography

Below are the components of elliptic curve cryptography:

1. ECC keys:

  • Private key: ECC cryptography’s private key creation is as simple as safely producing a random integer in a specific range, making it highly quick. Any integer in the field represents a valid ECC private key.
  • Public keys: Public keys within ECC are EC points, which are pairs of integer coordinates x, and y that lie on a curve. Because of its unique features, EC points can be compressed to a single coordinate + 1 bit (odd or even). As a result, the compressed public key corresponds to a 256-bit ECC.

2. Generator Point:

  • ECC cryptosystems establish a special pre-defined EC point called generator point G (base point) for elliptic curves over finite fields, which can generate any other position in its subgroup over the elliptic curve by multiplying G from some integer in the range [0…r].
  • The number r is referred to as the “ordering” of the cyclic subgroup.
  • Elliptic curve subgroups typically contain numerous generator points, but cryptologists carefully select one of them to generate the entire group (or subgroup), and is excellent for performance optimizations in calculations. This is the “G” generator.

Elliptic Curve Cryptography Algorithms

Based on the arithmetic of elliptic curves over finite fields, Elliptic-Curve Cryptography (ECC) provides numerous sets of algorithms:

Digital signature algorithms:

  • Elliptic Curve Digital Signature Algorithm. (ECDSA): ECDSA, or Elliptic Curve Digital Signature Algorithm, is a more highly complicated public-key cryptography encryption algorithm. Elliptic curve cryptography is a type of public key cryptography that uses the algebraic structure of elliptic curves with finite fields as its foundation. Elliptic curve cryptography is primarily used to generate pseudo-random numbers, digital signatures, and other data.
  • Edwards-curve Digital Signature Algorithm (EdDSA): The Edwards-curve Digital Signature Algorithm (EdDSA) was proposed as a replacement for the Elliptic Curve Digital Signature Algorithm for performing fast public-key digital signatures (ECDSA). Its primary benefits for embedded devices are higher performance and simple, secure implementations. During a signature, no branch or lookup operations based on the secret values are performed. Many side-channel attacks are foiled by these properties.

Encryption algorithms:

  • Elliptic Curve Integrated Encryption Scheme (ECIES): ECIES is a public-key authenticated encryption scheme that uses a KDF (key-derivation function) to generate a separate Medium Access Controlkey and symmetric encryption key from the ECDH shared secret. Because the ECIES algorithm incorporates a symmetric cipher, it can encrypt any amount of data. In practice, ECIES is used by standards such as Intelligent Transportation Systems.
  • EC-based ElGamal Elliptic Curve Cryptography: ElGamal Elliptic Curve Cryptography is the public key cryptography equivalent of ElGamal encryption schemes that employ the Elliptic Curve Discrete Logarithm Problem. ElGamal is an asymmetric encryption algorithm that is used to send messages securely over long distances. Unfortunately, if the encrypted message is short enough, the algorithm is vulnerable to a Meet in the Middle attack.

Key Agreement algorithm:

  • Elliptic-curve Diffie–Hellman (ECDH): Elliptic-curve Diffie-Hellman (ECDH) is a key agreement protocol that enables two parties to establish a shared secret over an insecure channel, each with an elliptic-curve public-private key pair. This shared secret can be used directly as a key or to generate another key. Following that, the key, or the derived key, can be used to encrypt subsequent communications with a symmetric-key cipher.
  • Fully Hashed Menezes-Qu-Vanstone(FHMQV): Fully Hashed Menezes-Qu-Vanstone is an authenticated key agreement protocol based on the Diffie-Hellman scheme. MQV, like other authenticated Diffie-Hellman schemes, protects against an active attacker. The protocol can be adapted to work in any finite group, most notably elliptic curve groups, in which it is recognized as elliptic curve MQV (ECMQV).

Application of Elliptic Curve Cryptography

  • Diffie-Hellman: The basic public-key cryptosystem suggested for secret key sharing is the Diffie-Hellman protocol. If A (Alice) and B (Bob) initially agree on a given curve, field size, and mathematical type. They then distribute the secret key in the following manner. We can see that all we need to build the Diffie-Hellman protocol is scalar multiplication.
  • Elliptic Curve Digital Signature Algorithm (ECDSA): ECC is one of the most widely utilized digital signature implementation approaches in cryptocurrencies. In order to sign transactions, both Bitcoin and Ethereum use the field inverse multiplication, but also arithmetic multiplication, inverse function, and modular operation.
  • Online application: Moreover, ECC is not limited to cryptocurrencies. It is an encryption standard that will be utilized by most online apps in the future due to its reduced key size and efficiency. Most commonly used in cryptocurrencies such as Bitcoin and Ethereum, along with single-way encryption of emails, data, and software.
  • Blockchain application: The cryptocurrency Bitcoin employs elliptic curve cryptography. Ethereum 2.0 makes heavy use of elliptic curve pairs with BLS signatures, as stated in the IETF proposed BLS specification, to cryptographically ensure that a specific Eth2 validator has really verified a specific transaction.

ECC vs RSA

Below is the difference between ECC and RSA:

Parameters

ECC

RSA

Working algorithmECC is a cryptography techniquethat works just on a mathematical model of elliptic curves.RSA cryptography algorithmis primarily basedon the prime factorization approach.
Bandwidth savingsECC gives significant bandwidth savings over RSA.RSA provides much lesser bandwidth saving than ECC.
Encryption processThe encryption process takes less time in ECC.The encryption process takes more time in RSA.
Decryption processThe decryption process takes more time.Decryption is faster than ECC.
SecurityECC is much safer than RSA and is currently in the process of adapting.RSA is heading toward the end of its tenure.

ECC vs RSA: Key Length Comparison:

Security(in Bits)

RSA key length required

ECC key length required

80

1024

160-223

112

2048

224-255

128

3072

256-383

192

7680

384-511

256

15360

512+

Elliptic curve Diffie-Hellman Protocol Implementation

Prerequisite: Basics of python programming language, basics of cryptography techniques, and Elliptic curve Diffie-Hellman Protocol.

Install tinyec in Python:

pip install tinyec

Blockchain - Elliptic Curve Cryptography - GeeksforGeeks (3)

After the required modules and dependencies are installed then use the following code for the calculation of the shared secret key between user A and user B.

Python

# Importing required libraries used

# to perform arithmetic operations

# on elliptic curves

from tinyec import registry

import secrets

# Function to calculate compress point

# of elliptic curves

def compress(publicKey):

return hex(publicKey.x) + hex(publicKey.y % 2)[2:]

# The elliptic curve which is used for the ECDH calculations

curve = registry.get_curve('brainpoolP256r1')

# Generation of secret key and public key

Ka = secrets.randbelow(curve.field.n)

X = Ka * curve.g

print("X:", compress(X))

Kb = secrets.randbelow(curve.field.n)

Y = Kb * curve.g

print("Y:", compress(Y))

print("Currently exchange the publickey (e.g. through Internet)")

# (A_SharedKey): represents user A

# (B_SharedKey): represents user B

A_SharedKey = Ka * Y

print("A shared key :",compress(A_SharedKey))

B_SharedKey = Kb * X

print("(B) shared key :",compress(B_SharedKey))

print("Equal shared keys:", A_SharedKey == B_SharedKey)

Output:

Blockchain - Elliptic Curve Cryptography - GeeksforGeeks (4)

Explanation:

  • The following Python code generates an ECC private-public key pair for the recipient of the message (based on the brainpoolP256r1 curve), then derives a secret shared key (for encryption) and an ephemeral cipher – text key (for ECDH) from the recipient’s public key, and then derives same secret key pair (for decryption) from the recipient’s secret key and the previously generated ephemeral ciphertext public key.
  • In an integrated encryption scheme, these keys will be utilized for data encryption and decryption. If you execute the code, the above output will differ (due to the randomness used to produce ciphertextPrivKey), but the decryption and encryption keys will remain the same.
  • The process for producing a shared ephemeral secret key based on an ECC key pair described above is an example of a KEM (a key encapsulating mechanism) based on the ECC and ECDH.

Types of Security Attacks

  • Side-channel attack: Side-channel attacks in elliptic curve cryptography are caused by unintended information leaking during processing. The computation of n*P, where n is a positive number and P is a location on the elliptic curve E, is a critical operation.
  • Backdoor attack: Concerns have been made by cryptographic specialists that the National Security Agency has installed a kleptographic backdoor into at least one elliptic curve-based pseudo-random generator. According to one investigation of the potential backdoor, an attacker in possession of the algorithm’s secret key might access encryption keys provided only 32 bytes of outputs.
  • Quantum computing attacks: By calculating discrete logarithms on a hypothetical quantum computer, Shor’s technique can be used to break elliptic curve cryptography. The most recent quantum resource estimates are 2330 qubits and 126 billion Toffoli gates for cracking a curve with only a 256-bit modulus (128-bit security level).

Benefits of Elliptic Curve Cryptography

  • Fast key generation: ECC cryptography’s key creation is as simple as securely producing a random integer in a specific range, making it highly quick. Any integer in the range represents a valid ECC secret key. The public keys in the ECC are EC points, which are pairs of integer coordinates x, and y that lie on a curve.
  • Smaller key size: Cipher text, signatures, and Elliptic-curve cryptography (ECC) is a public-key encryption technique based on the algebraic structure of elliptic curves with finite fields. Compared to non-EC encryption (based on ordinary Galois fields), ECC allows for fewer keys to guarantee equal security.
  • Low latency: Signatures can be computed in two stages, allowing latency much lower. By computing signatures in two stages, ECC achieves lower latency than the inverse throughout. ECC has robust protocols for authorized key exchange, and the technology has widespread adoption.
  • Less computation power: Since the ECC key is shorter the computation power is also less computational power, ECC offers high security with faster, shorter keys compared to RSA and take more energy to factor than it does to calculate an elliptic curve objective function.
  • High security: A 256-bit ECC public key ensures comparable security to a 3072-bit RSA public key. With ECC, you may obtain the same level of security with smaller keys. ECC provides strong security in a world where mobile phones must do more and more encryption with fewer computational resources.

Limitations of Elliptic Curve Cryptography

  • Large encryption size: ECC increases the size of the encrypted message significantly more than RSA encryption. The default key length for ECC private keys is 256 bits, but many different ECC key sizes are conceivable depending on the curve.
  • A more complex: The ECC algorithm is more complete and more difficult to implement than RSA. Algorithms cost have been computed from the computation of the elliptic curve operation and finite field operations that determine the running time of the scalar multiplication integer sub-decomposition (ISD) method.
  • Complex security: Complicated and tricky to implement securely, mainly the standard curves. If the key size used is large enough, ECC is regarded to be highly secure. For internal communications, the US government needs ECC with a key size of either 256 or 384 bits, depending on the sensitivity level of the material being communicated.
  • Binary curves: Processing of binary curves is costly. Elliptic curve cryptography (ECC) employs elliptic curves over finite fields Fp (where p is prime and p > 3) or F2m (where the field size p = 2 m_). This means that the field is a p x p square matrix, and the points on the curve can only have integer locations within the field.

Conclusion

  • Encryption strength: The main distinction between RSA and ECC certificates is the encryption strength. When compared to other approaches, such as RSA, ECC can provide a level of security that uses fewer processing resources to encrypt and decrypt data.
  • ECC Keys feature: With a lower key length, Elliptic Curve Cryptography (ECC) delivers the same level of encryption strength as the RSA.ECC and other public key encryption systems use a mathematical technique to combine two separate keys and then use the resulting output to encrypt and decrypt data. One is a public key that anybody can see, and the other is a private key that only the sender and receiver of the data can see.
  • ECC certificates: As a result, for Public Key Infrastructure, an ECC certificate provides more speed and security than an RSA certificate. Elliptic Curve Cryptography (ECC) provides an equivalent level of encryption strength to the RSA algorithm with a shorter key length.
  • ECC curves: The elliptic curve over a finite area gives us more security. For contemporary ECC purposes, an elliptic curve is a plane curve over a finite field composed of points fitting the equation: Any point on the curve in this elliptic curve cryptography example can be mirrored over the x-axis and the curve will remain unchanged.
  • Use of prime number: Zp (where p is a prime number) elliptic curve When p is a huge prime integer, it indicates that the cipher text is extremely tough to crack. The public and shared keys are both 257 bits long (65 hexadecimal digits, 256 bits due to key compression). The private keys KA and KB are different due to randomness, but the estimated shared secret key across (A) and (B) will always be the same.


Please Login to comment...

Similar Reads

15+ min read

Blockchain - Creating Elliptic Curve Keys using OpenSSL

Elliptic curve cryptography is employed to implement public key cryptography. It had been discovered by Victor Miller of IBM and Neal Koblitz of the University of Washington in 1985. ECC, popularly utilized, is an acronym for Elliptic Curve Cryptography. It's grounded on recent mathematics and delivers a reasonably more secure foundation than the f

3 min read

Cryptography in Blockchain

One of the important questions that always comes to our mind is How blockchain is secure? and What makes blockchain secure? Blockchain security is built on two concepts Cryptography and Hashing. This article focuses on discussing these two important concepts in detail. Cryptography in BlockchainCryptography is a method of securing data from unautho

8 min read

Blockchain - Public Key Cryptography

Blockchain technology is one of the greatest innovations of the 21st century. In this article, we will focus on the concept of cryptography i.e. public-key cryptography or Asymmetric key cryptography. Introduction To Public-Key CryptographyMost of the time blockchain uses public-key cryptography, also known as asymmetric-key cryptography. Public ke

6 min read

Blockchain - Private Key Cryptography

Private key encryption is an encryption method that allows users to send and receive information securely over a network. As part of the blockchain, private key cryptography is used to ensure the security of transactions and ownership of digital assets. What is Private-Key Cryptography?Private key cryptography also known as symmetric-key cryptograp

8 min read

Flutter and Blockchain - Hello World Dapp

This tutorial will take you through the process of building your first mobile dapp - Hello World Dapp! This tutorial is meant for those with a basic knowledge of Ethereum and smart contracts, who have some knowledge of the Flutter framework but are new to mobile dapps. In this tutorial we will be covering: Setting up the development environmentCrea

9 min read

Integration of Artificial Intelligence and BlockChain

Artificial Intelligence and Blockchain are proving to be quite a powerful combination, improving virtually every industry in which they're implemented. These technologies can be combined to upgrade everything from food supply chain logistics and healthcare record sharing to media royalties and financial security. The integration of AI and Blockchai

8 min read

How to use GANACHE Truffle Suite to Deploy a Smart Contract in Solidity (Blockchain)?

There are various processes involved in deploying a smart contract using Ganache and Truffle Suite: 1. Install Ganache first. Ganache is a personal blockchain for Ethereum development. You must first download and install it. It is available for download from https://www.trufflesuite.com/ganache, the official website. 2. Install Truffle Suite: The n

4 min read

Introduction to Blockchain technology | Set 2

Blockchain technology has been garnering great hype recently. It gained popularity after the introduction of Bitcoin in 2009 by the person or group of people by the pseudonym Satoshi Nakamoto. Many people confuse and believe blockchain to be bitcoin. But, bitcoin is one application of the blockchain technology. There are many other applications and

5 min read

What is Blockchain Wallet?

A blockchain wallet is a software that enables sending and receiving cryptocurrencies such as Bitcoin, Ethereum, etc. It stores the record of transactions and also public and private keys which are used to perform transactions. A public key is similar to an account number. If A wants to send some money to B using Bitcoin when A sends the public key

10 min read

What is Consortium Blockchain?

A consortium blockchain is a group of multiple financial institutions where each financial institution has its private blockchain. In this blockchain, a pre-selected set of nodes are allowed to control the consensus process. What is Consortium Blockchain?Consortium blockchains are managed and run by a number of organizations or entities. As a permi

9 min read

Blockchain - Proof of Work (PoW)

Proof of Work consensus is the mechanism of choice for the majority of cryptocurrencies currently in circulation. The algorithm is used to verify the transaction and create a new block in the blockchain. The idea for Proof of Work(PoW) was first published in 1993 by Cynthia Dwork and Moni Naor and was later applied by Satoshi Nakamoto in the Bitcoi

6 min read

Benefits of Blockchain Technology

Blockchain is the backbone Technology of Digital CryptoCurrency BitCoin. Blockchain technology is a digital or ledger technology that evaluates the records and makes track of it in a peer-to-peer network. Each transaction is verified by the majority of participants of the system. It contains every single record of each transaction. Benefits of Bloc

5 min read

Blockchain and Data Privacy

Blockchain has been defined as a digital, decentralized ledger that keeps a record of all transactions that take place across a peer-to-peer network. It enables the secure transfer of assets without an intermediary. It also provides a record of transactions that is fully transparent and displayed in real-time for benefit of participants. Blockchain

11 min read

7 Project Ideas on Blockchain For Professionals

We have passed the time when blockchain was used only in the form of cryptocurrency. Today, it is being used in a broader domain and it's going to dominate in the coming future. As per the latest reports, it is expected that corporations will spend around $20 Billion on blockchain technical services by 2024. Industries like Healthcare, Insurance, I

8 min read

Consensus Algorithms in Blockchain

Prerequisites: Introduction to Blockchain technology | Set 1, Set 2 We know that Blockchain is a distributed decentralized network that provides immutability, privacy, security, and transparency. There is no central authority present to validate and verify the transactions, yet every transaction in the Blockchain is considered to be completely secu

5 min read

Blockchain to Secure IoT Data

INTRODUCTION: Internet of things and Blockchain are two technologies which are gaining popularity since the time of their creation. In the near future, IoT is going to influence almost every day-to-day items we use. As the usage of this technology increases, the threat to misuse it also increases. Existing technologies are not enough to deal with t

7 min read

Difference between Blockchain and a Database

Database: Generally a database is a data structure which is used for storing information. It is a organised collection or storage of data which is able to store a new data or access a existing data. The data stored in a database can be organized using a database management system. The database administrator can modify the data stored in the databas

2 min read

What Are Cryptoasssets in Blockchain

So as you are aware of Blockchain technology and have of the basic idea of it, in this article we will be talking about the cryptocurrency part of the blockchain, more specifically about the crypto-assets. As we know, an asset is something that holds value, similarly, a crypto-asset is an asset that is based on cryptography. Mostly it is a virtual

3 min read

Basics of the Blockchain and its various applications

The BlockChain, to begin with is undeniably one of the most ingenious inventions of mankind. Considering it to be the brainchild the pseudonym, Satoshi Nakamoto, the technology has evolved into something unimaginably great. However, the most commonly asked always arises every single time - What is this Blockchain? A BlockChain is defined as a peer

5 min read

Proof of Stake (PoS) in Blockchain

Proof of Stake (PoS) is a type of algorithm which aims to achieve distributed consensus in a Blockchain. This way to achieve consensus was first suggested by Quantum Mechanic here and later Sunny King and his peer wrote a paper on it. This led to Proof-of-Stake (PoS) based Peercoin. A stake is value/money we bet on a certain outcome. The process is

5 min read

How Block Hashes Work in Blockchain?

Blockchain is the backbone technology of the digital cryptocurrency Bitcoin. The blockchain is a distributed database of records of all transactions or digital events that have been executed and shared among participating parties. Each transaction is verified by the majority of participants of the system. It contains every single record of each tra

7 min read

Features of Blockchain

Here In this article, we will discuss the features of blockchain technology and how they make it a revolutionary and highly desirable platform for various applications. A blockchain is a chain of blocks that contains information. Most people think that Blockchain is Bitcoin and vice-versa. But it’s not the case. In fact, Bitcoin is a digital curren

7 min read

How does BlockChain support Crowdfunding ?

The Crowdfunding platform in block-chain makes different possibilities for the startups by raising the funds to create their own digital currency and it is peer-to-peer fund raising model some of the famous crowdfunding cryptocurrencies are coinspace, swarm, judobaby etc. Crowdfunding has offers for creators and other consumers. Anyone can particip

2 min read

Demur-rage currencies in Blockchain

Currency is one such core concept in blockchain technology that can extended and re-understood. Currency which is usually referred as digital token it facilitates quantified transfer mechanism. This idea is known as Demur-rage currency. Demur-rage means "cost of carrying"- that is the cost to carry an asset. The Demur-rage originated from freight a

2 min read

Blockchain Gaming : Part 1 (Introduction)

Blockchain Gaming. It’s a world of it’s own. It’s ‘Ready Player One’ incorporated into gaming. Before reading this article, it is recommended to read: Introduction to Blockchain to get well versed with the concept of blockchain. Part-1: Transparency, Proven Rarity and True Ownership Transparency: When games use third party distribution platforms li

4 min read

Blockchain Hash Function

A hash function is a mathematical function that takes an input string of any length and converts it to a fixed-length output string. The fixed-length output is known as the hash value. To be cryptographically secure and useful, a hash function should have the following properties: Collision resistant: Give two messages m1 and m2, it is difficult to

5 min read

Guidelines for learning Blockchain

As a beginner, while starting learning something new everyone is having a question in mind, "How to get started?". When I started learning Blockchain I was in the same situation. So I want to share my journey of BLOCKCHAIN with you, by this, every technical worm who is interested in learning new technologies will get an idea about this trending tec

6 min read

Blockchain and Block Header

Blockchain is a database, or broadly distributed database, used mainly for concurrent transactions and one of the most popular implementations of blockchain is Bitcoin. Blockchain has several blocks, also called nodes, and all the blocks are managed with the help of the block header. Constituents of Block Header are : TimestampVersionMerkle RootDif

3 min read

Top 10 Programming Languages for Blockchain Development

Do you ever wonder about the sudden emergence and popularity of Blockchain? What is it? Well, Blockchain is literally a chain of blocks as the name suggests! It’s just that the “blocks” in this context are digital information that is connected using cryptography. Each of these blocks contains a cryptographic hash function linking to the previous bl

7 min read

We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood our Cookie Policy & Privacy Policy

Blockchain - Elliptic Curve Cryptography - GeeksforGeeks (6)

'); $('.spinner-loading-overlay').show(); jQuery.ajax({ url: writeApiUrl + 'create-improvement-post/?v=1', type: "POST", contentType: 'application/json; charset=utf-8', dataType: 'json', xhrFields: { withCredentials: true }, data: JSON.stringify({ gfg_id: post_id, check: true }), success:function(result) { jQuery.ajax({ url: writeApiUrl + 'suggestions/auth/' + `${post_id}/`, type: "GET", dataType: 'json', xhrFields: { withCredentials: true }, success: function (result) { $('.spinner-loading-overlay:eq(0)').remove(); var commentArray = result; if(commentArray === null || commentArray.length === 0) { // when no reason is availaible then user will redirected directly make the improvment. // call to api create-improvement-post $('body').append('

'); $('.spinner-loading-overlay').show(); jQuery.ajax({ url: writeApiUrl + 'create-improvement-post/?v=1', type: "POST", contentType: 'application/json; charset=utf-8', dataType: 'json', xhrFields: { withCredentials: true }, data: JSON.stringify({ gfg_id: post_id, }), success:function(result) { $('.spinner-loading-overlay:eq(0)').remove(); $('.improve-modal--overlay').hide(); $('.unlocked-status--improve-modal-content').css("display","none"); $('.create-improvement-redirection-to-write').attr('href',writeUrl + 'improve-post/' + `${result.id}` + '/', '_blank'); $('.create-improvement-redirection-to-write')[0].click(); }, error:function(e) { $('.spinner-loading-overlay:eq(0)').remove(); var result = e.responseJSON; if(result.detail.non_field_errors.length){ $('.improve-modal--improve-content .improve-modal--improve-content-modified').text(`${result.detail.non_field_errors}.`); jQuery('.improve-modal--overlay').show(); jQuery('.improve-modal--improvement').show(); $('.locked-status--impove-modal').css("display","block"); $('.unlocked-status--improve-modal-content').css("display","none"); $('.improve-modal--improvement').attr("status","locked"); $('.improvement-reason-modal').hide(); } }, }); return; } var improvement_reason_html = ""; for(var comment of commentArray) { // loop creating improvement reason list markup var comment_id = comment['id']; var comment_text = comment['suggestion']; improvement_reason_html += `

${comment_text}

`; } $('.improvement-reasons_wrapper').html(improvement_reason_html); $('.improvement-bottom-btn').html("Create Improvement"); $('.improve-modal--improvement').hide(); $('.improvement-reason-modal').show(); }, error: function(e){ $('.spinner-loading-overlay:eq(0)').remove(); // stop loader when ajax failed; }, }); }, error:function(e) { $('.spinner-loading-overlay:eq(0)').remove(); var result = e.responseJSON; if(result.detail.non_field_errors.length){ $('.improve-modal--improve-content .improve-modal--improve-content-modified').text(`${result.detail.non_field_errors}.`); jQuery('.improve-modal--overlay').show(); jQuery('.improve-modal--improvement').show(); $('.locked-status--impove-modal').css("display","block"); $('.unlocked-status--improve-modal-content').css("display","none"); $('.improve-modal--improvement').attr("status","locked"); $('.improvement-reason-modal').hide(); } }, }); } else { if(loginData && !loginData.isLoggedIn) { $('.improve-modal--overlay').hide(); if ($('.header-main__wrapper').find('.header-main__signup.login-modal-btn').length) { $('.header-main__wrapper').find('.header-main__signup.login-modal-btn').click(); } return; } } }); $('.left-arrow-icon_wrapper').on('click',function(){ if($('.improve-modal--suggestion').is(":visible")) $('.improve-modal--suggestion').hide(); else{ $('.improvement-reason-modal').hide(); } $('.improve-modal--improvement').show(); }); function loadScript(src, callback) { var script = document.createElement('script'); script.src = src; script.onload = callback; document.head.appendChild(script); } function suggestionCall() { var suggest_val = $.trim($("#suggestion-section-textarea").val()); var array_String= suggest_val.split(" ") var gCaptchaToken = $("#g-recaptcha-response-suggestion-form").val(); var error_msg = false; if(suggest_val != "" && array_String.length >=4){ if(suggest_val.length <= 2000){ var payload = { "gfg_post_id" : `${post_id}`, "suggestion" : `

${suggest_val}

`, } if(!loginData || !loginData.isLoggedIn) // User is not logged in payload["g-recaptcha-token"] = gCaptchaToken jQuery.ajax({ type:'post', url: "https://apiwrite.geeksforgeeks.org/suggestions/auth/create/", xhrFields: { withCredentials: true }, crossDomain: true, contentType:'application/json', data: JSON.stringify(payload), success:function(data) { jQuery('.spinner-loading-overlay:eq(0)').remove(); jQuery('#suggestion-section-textarea').val(""); jQuery('.suggest-bottom-btn').css("display","none"); // Update the modal content const modalSection = document.querySelector('.suggestion-modal-section'); modalSection.innerHTML = `

Thank You!

Your suggestions are valuable to us.

You can now also contribute to the GeeksforGeeks community by creating improvement and help your fellow geeks.

`; }, error:function(data) { jQuery('.spinner-loading-overlay:eq(0)').remove(); jQuery('#suggestion-modal-alert').html("Something went wrong."); jQuery('#suggestion-modal-alert').show(); error_msg = true; } }); } else{ jQuery('.spinner-loading-overlay:eq(0)').remove(); jQuery('#suggestion-modal-alert').html("Minimum 5 Words and Maximum Character limit is 2000."); jQuery('#suggestion-modal-alert').show(); jQuery('#suggestion-section-textarea').focus(); error_msg = true; } } else{ jQuery('.spinner-loading-overlay:eq(0)').remove(); jQuery('#suggestion-modal-alert').html("Enter atleast four words !"); jQuery('#suggestion-modal-alert').show(); jQuery('#suggestion-section-textarea').focus(); error_msg = true; } if(error_msg){ setTimeout(() => { jQuery('#suggestion-section-textarea').focus(); jQuery('#suggestion-modal-alert').hide(); }, 3000); } } document.querySelector('.suggest-bottom-btn').addEventListener('click', function(){ jQuery('body').append('

'); jQuery('.spinner-loading-overlay').show(); if(loginData && loginData.isLoggedIn) { suggestionCall(); return; } // load the captcha script and set the token loadScript('https://www.google.com/recaptcha/api.js?render=6LdMFNUZAAAAAIuRtzg0piOT-qXCbDF-iQiUi9KY',[], function() { setGoogleRecaptcha(); }); }); $('.improvement-bottom-btn.create-improvement-btn').click(function() { //create improvement button is clicked $('body').append('

'); $('.spinner-loading-overlay').show(); // send this option via create-improvement-post api jQuery.ajax({ url: writeApiUrl + 'create-improvement-post/?v=1', type: "POST", contentType: 'application/json; charset=utf-8', dataType: 'json', xhrFields: { withCredentials: true }, data: JSON.stringify({ gfg_id: post_id }), success:function(result) { $('.spinner-loading-overlay:eq(0)').remove(); $('.improve-modal--overlay').hide(); $('.improvement-reason-modal').hide(); $('.create-improvement-redirection-to-write').attr('href',writeUrl + 'improve-post/' + `${result.id}` + '/', '_blank'); $('.create-improvement-redirection-to-write')[0].click(); }, error:function(e) { $('.spinner-loading-overlay:eq(0)').remove(); var result = e.responseJSON; if(result.detail.non_field_errors.length){ $('.improve-modal--improve-content .improve-modal--improve-content-modified').text(`${result.detail.non_field_errors}.`); jQuery('.improve-modal--overlay').show(); jQuery('.improve-modal--improvement').show(); $('.locked-status--impove-modal').css("display","block"); $('.unlocked-status--improve-modal-content').css("display","none"); $('.improve-modal--improvement').attr("status","locked"); $('.improvement-reason-modal').hide(); } }, }); });

Blockchain - Elliptic Curve Cryptography - GeeksforGeeks (2024)
Top Articles
How Amazon has disrupted the book industry - Reading, Writing, Research
Airbnb (ABNB): Porter’s Five Forces Industry and Competition Analysis
Toa Guide Osrs
Top 11 Best Bloxburg House Ideas in Roblox - NeuralGamer
Room Background For Zepeto
Quick Pickling 101
Chambersburg star athlete JJ Kelly makes his college decision, and he’s going DI
Mr Tire Prince Frederick Md 20678
Tv Guide Bay Area No Cable
Es.cvs.com/Otchs/Devoted
Die Windows GDI+ (Teil 1)
Plus Portals Stscg
How to Type German letters ä, ö, ü and the ß on your Keyboard
Khatrimaza Movies
Nikki Catsouras Head Cut In Half
Matthew Rotuno Johnson
Identogo Brunswick Ga
Dump Trucks in Netherlands for sale - used and new - TrucksNL
Belle Delphine Boobs
Overton Funeral Home Waterloo Iowa
Gdlauncher Downloading Game Files Loop
Marvon McCray Update: Did He Pass Away Or Is He Still Alive?
Welcome to GradeBook
Swgoh Blind Characters
Atdhe Net
Sussyclassroom
Air Traffic Control Coolmathgames
Kingdom Tattoo Ithaca Mi
Regal Amc Near Me
Chicago Based Pizza Chain Familiarly
Student Portal Stvt
Kimoriiii Fansly
Ringcentral Background
100 Million Naira In Dollars
1475 Akron Way Forney Tx 75126
Dreamcargiveaways
Cars And Trucks Facebook
Gas Prices In Henderson Kentucky
The Syracuse Journal-Democrat from Syracuse, Nebraska
Kelly Ripa Necklace 2022
Myanswers Com Abc Resources
Adam Bartley Net Worth
The Holdovers Showtimes Near Regal Huebner Oaks
This 85-year-old mom co-signed her daughter's student loan years ago. Now she fears the lender may take her house
Immobiliare di Felice| Appartamento | Appartamento in vendita Porto San
Sour OG is a chill recreational strain -- just have healthy snacks nearby (cannabis review)
Guided Practice Activities 5B-1 Answers
Petfinder Quiz
Arginina - co to jest, właściwości, zastosowanie oraz przeciwwskazania
Here’s What Goes on at a Gentlemen’s Club – Crafternoon Cabaret Club
Joe Bartosik Ms
Latest Posts
Article information

Author: Tyson Zemlak

Last Updated:

Views: 6245

Rating: 4.2 / 5 (43 voted)

Reviews: 82% of readers found this page helpful

Author information

Name: Tyson Zemlak

Birthday: 1992-03-17

Address: Apt. 662 96191 Quigley Dam, Kubview, MA 42013

Phone: +441678032891

Job: Community-Services Orchestrator

Hobby: Coffee roasting, Calligraphy, Metalworking, Fashion, Vehicle restoration, Shopping, Photography

Introduction: My name is Tyson Zemlak, I am a excited, light, sparkling, super, open, fair, magnificent person who loves writing and wants to share my knowledge and understanding with you.