DriversRecommendedOutdated drivers can make a good PC feel brokenScan driver issues before chasing fixes manually.Scan NowHalloween DealsAmazon USHalloween week deals: useful picks before month-endAmazon US: current deals, useful picks and tech finds.Check DealsSlow PC?RecommendedPC slow today? Run a repair scan before it gets worseResolve common Windows issues and optimize system performance.Scan Now×
Skip to content
World desk4 min

Public and Private Keys, Hashing, and How They Work Together

Public keys can be shared, private keys must remain secret, and hashes produce fixed-length digests. Learn how these concepts differ and work together.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

A public/private key pair consists of two mathematically related cryptographic keys: the public key can be shared, while its matching private key must remain secret. A cryptographic hash is different: it turns input of any length into a fixed-length digest. Keys, hashes, encryption, and digital signatures serve distinct roles.

What are public and private keys?

In public-key cryptography, a public key is associated with an entity and may be distributed. Its corresponding private key is kept secret. The keys are mathematically related, but NIST says the private key cannot efficiently be determined from knowledge of the public key. The exact operations available depend on the algorithm; a key pair should not be assumed to support every cryptographic task. NIST glossary: public key

As an Amazon Associate I earn from qualifying purchases.

Public key

A public key can be used to verify signatures, encrypt data or keys for the matching private key, or participate in key agreement, depending on the algorithm and protocol.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Private key

The private key is the secret counterpart. It can create signatures in a signature scheme, or decrypt data encrypted for its corresponding public key in a suitable encryption scheme. Keep it private; sharing the public key does not mean sharing the private one.

What is hashing?

A cryptographic hash function maps a message of arbitrary length to a fixed-length message digest, often called a hash. The digest is a compact representation of the input, not encrypted content. Hashing does not create a public/private key pair, and it does not provide a decryption key. NIST: Hash Functions

Approved hash functions are designed to resist three kinds of attack: finding two inputs with the same digest (a collision), finding an input for a given digest (a preimage), and finding another input with the same digest as a known input (a second preimage). A digest is not proof by itself that a message is authentic; its value depends on how it is used and protected.

How do signatures, encryption, and key agreement differ?

Operation Key role What it provides
Digital signature The private key signs; the matching public key verifies. Authenticity and integrity protection. It does not provide confidentiality or, by itself, replay-attack protection.
Public-key encryption A public key can encrypt data or key material that the matching private key can recover. Confidentiality for the intended private-key holder, when used in a suitable scheme.
Key agreement Public-key material is used in a protocol to help compute a shared secret. A shared secret for subsequent cryptographic use; it is not itself a signature.

These roles are algorithm- and protocol-dependent. In particular, a signature is not “encrypting with the private key”: signing and verification are a distinct operation. NIST defines a digital signature as an asymmetric operation in which the private key signs data and the public key verifies the signature. NIST SP 800-63-4, Digital Identity Guidelines

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

How does a hash work with a digital signature?

For a large message, a signature workflow commonly hashes the message and uses the resulting digest as input to the signature algorithm. The signer uses the private key to create the signature; a verifier uses the corresponding public key to check it. The hash is not the signature, and hashing alone does not authenticate the message. NISTIR 8202: Blockchain Technology Overview

A verified signature supports confidence that the signed data has not changed and that it was signed using the corresponding private key. It does not hide the message. Nor does a valid signature alone stop someone from replaying a previously valid signed message; protocols need separate measures for that risk.

Are all hash functions equally suitable?

No. The appropriate choice depends on the application, algorithm, protocol, and any standards requirements. NIST lists SHA-2 and SHA-3 options. Its current hash-functions page gives SHA-256 and SHA3-256 a collision-resistance strength of 128 bits and a preimage-resistance strength of 256 bits; these are security-strength estimates, not a guarantee about every implementation. NIST reports that SHA-1 was deprecated in 2011 and disallowed for digital signatures at the end of 2013, so it is not an appropriate choice for new digital signatures. NIST: Hash Functions

Is a blockchain address the same as a public key?

Not necessarily. Some blockchain implementations derive an address from a public key by hashing it and adding other data. The resulting address is not necessarily the public key itself or simply its raw hash; the derivation rules vary by implementation. NIST’s 2018 blockchain overview notes that each implementation may use a different address-derivation method. NISTIR 8202: Blockchain Technology Overview

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

How are cryptographic keys generated?

Key generation is a separate operation from hashing. It must follow the requirements of the relevant algorithm and protocol; a hash function does not turn an arbitrary value into a secure key pair. NIST SP 800-133 Rev. 2 provides U.S. federal recommendations for cryptographic key generation, but the existence of that guidance does not establish that any particular software or implementation follows it. NIST SP 800-133 Rev. 2: Recommendation for Cryptographic Key Generation

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Crashes, No Sound, or Screen Glitches?Free driver scan
PC Slower Than It Used to Be?Free scan - under a minute

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.