![Trending Articles on Technical and Non Technical topics](/images/trending_categories.jpeg)
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How long is the SHA256 hash in MySQL?
As the name “SHA256” suggest, it is 256 bits long. If we are using hexadecimal notation then digit codes represent 4 bits. In order to represent 256, we need 256/4 = 64 bits. We need a data type varchar(64) or char(64).
Creating a table for our example.
mysql> create table SHA256Demo -> ( -> Password varchar(64) -> ); Query OK, 0 rows affected (0.54 sec)
Inserting records into table.
mysql> insert into SHA256Demo values(' 4e2e1a39dba84a0b5a91043bb0e4dbef23970837'); Query OK, 1 row affected (0.18 sec)
Displaying all records.
mysql> select *From SHA256Demo;
The following is the output.
+-------------------------------------------+ | Password | +-------------------------------------------+ | 4e2e1a39dba84a0b5a91043bb0e4dbef23970837 | +-------------------------------------------+ 1 row in set (0.00 sec)
Advertisements