Hi All,
Can any one tell me the algorithm for MD5,SHA-256 encryption and decription. I can found MD5 emcryption but not unable to found decryption.
Thanks & Regards
Bhanu Teja M.
Hi All,
Can any one tell me the algorithm for MD5,SHA-256 encryption and decription. I can found MD5 emcryption but not unable to found decryption.
Thanks & Regards
Bhanu Teja M.
Short clarification and practical next steps building on what , and said: MD5 and SHA-2 family functions are cryptographic hashes (one-way digests), not encryption — you cannot "decrypt" them. MD5 in particular is broken for collision-resistance and must not be used for security decisions; passwords and other secrets should be handled with purpose-built password/KDF primitives, not raw hashes. (RFC 6151) (rfc-editor.org)
If the goal is to protect transactions in transit, use TLS/HTTPS correctly rather than inventing your own transport encryption; TLS gives confidentiality, integrity and authentication when properly configured. For message-level or at-rest encryption use authenticated-encryption (AEAD) primitives (for example AES-GCM or ChaCha20-Poly1305), ensure nonces/IVs are never reused for the same key, and manage/rotate keys with a proper key-management system. Do not mix raw encryption without authentication — AEAD protects integrity as well as confidentiality. (OWASP TLS cheat sheet, Cryptographic Storage guidance, AEAD overview). (cheatsheetseries.owasp.org)
Java notes you can apply immediately: use the JCA/Cipher AEAD support (for example AES/GCM/NoPadding) with a 12-byte random IV from SecureRandom and GCMParameterSpec; never reuse IVs for the same key. Example pattern (trimmed):
Cipher c = Cipher.getInstance("AES/GCM/NoPadding");
GCMParameterSpec spec = new GCMParameterSpec(128, iv);
c.init(Cipher.ENCRYPT_MODE, key, spec); Also, for passwords prefer Argon2id (or scrypt/bcrypt if Argon2 is unavailable) rather than MD5/SHA256. Keep libraries and JVM patched and prefer vetted libraries (JCA providers, BouncyCastle, libsodium bindings) and external KMS/HSM for production key management. (Java Cipher docs, OWASP Password Storage Cheat Sheet). (docs.oracle.com)
Jump to Post— gusano79 247MD5 and SHA-256 are hash functions, not encryption algorithms. They only work one way, which is why you aren't finding anything else; that they are non-reversible is quite intentional.
Is this for something …
Jump to Post— Assembly Guy 72As gusano79 said, hash functions are one-way, which makes them perfect for encrypting things like passwords. They are never decrypted, but instead the password a user enters when logging in is hashed. This hash is then comapred with the hash of the correct password which is on record.
If you …
MD5 and SHA-256 are hash functions, not encryption algorithms. They only work one way, which is why you aren't finding anything else; that they are non-reversible is quite intentional.
Is this for something specific you're trying to accomplish, or are you just exploring security concepts?
As gusano79 said, hash functions are one-way, which makes them perfect for encrypting things like passwords. They are never decrypted, but instead the password a user enters when logging in is hashed. This hash is then comapred with the hash of the correct password which is on record.
If you want to reverse a hash, you'll have to do it indirectly, by undergoing a painstaking operation of brute-forcing it. For example generating strings in a predictable order (a,b,c,d,e,f ... aa,ab,ac .. ba,bb,bc etc.) and hashing each string until the produced hash matches the hash you wanted to reverse. This is extremely expensive (time, electricity used by the computer) so there's really no point.
What gusano79 and assembly guy said. The sources and description of function of the md5 and sha-nnn hash functions are freely available on the web. Here is a link to the md5 article on wikipedia, including very clearly written pseudo-code that should be easily converted to most any computer language. http://en.wikipedia.org/wiki/MD5
Hi gusano79,
Thanks for reply. I want to make my app secure, so i want to encrypt & decrypt my transactions every time. Is there any best algorithms for encryption and decryption?
which makes them perfect for encrypting things like passwords
Just so everyone's clear here: Hashing passwords is NOT encryption. It is part of a technique to verify (to a reasonable degree of confidence) that the password a user provides is correct without having to actually store or transmit the password itself.
(time, electricity used by the computer)
The electric bill doesn't matter; it's all about time. Brute-force attacks are defeated by making it impractical to run through all possible keys before the sun turns into a red giant.
I want to make my app secure, so i want to encrypt & decrypt my transactions every time.
If you're writing a web application, make sure your server only uses HTTPS. If you're managing your own connections, consider something like TLS.
Is there any best algorithms for encryption and decryption
For symmetric algorithms, AES is a common choice.
For asymmetric algorithms, RSA is widely used.
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.