当前位置:网站首页>C one line code calculates the MD5 value of the file - codeplus series
C one line code calculates the MD5 value of the file - codeplus series
2022-07-01 09:54:00 【Great ape】
C# One line of code calculates the file's MD5 value
List of articles
Preface
MD5 Information digest algorithm ( English :MD5 Message-Digest Algorithm), A widely used cryptographic hash function , I can produce one 128 position (16 byte ) Hash value (hash value), Used to ensure complete and consistent transmission of information .
We often encounter calculation files in the process of development MD5 Scene . How to obtain one line of code simply and efficiently MD5 Is it worth it ? Let's have a look !
introduce CodePlus
Right click the item , choice management NuGet Package 
Enter... In the search field CodePlus, After selecting the package in the figure , Select Install .

Sample code
obtain MD5 Byte array
var md5 = new FileInfo(@"D:\pic.png").GetMD5();
obtain MD5 character string
var md5 = new FileInfo(@"D:\pic.png").GetMD5().ToHexString();
obtain MD5 Other relevant methods
// To get a small file MD5
var md5 = new FileInfo(@"D:\pic.png").GetMD5ForSmallFile().ToHexString();
// Get large file MD5
var md5 = new FileInfo(@"D:\pic.png").GetMD5ForLargeFile().ToHexString();
// Automatic selection ( Greater than 10MB Will execute GetMD5ForLargeFile, Less than or equal to 10MB Will execute GetMD5ForSmallFile)
var md5 = new FileInfo(@"D:\pic.png").GetMD5().ToHexString();
边栏推荐
- UE small knowledge point controller possess pawn process
- It is interesting to understand MMAP in this way!
- Huawei accounts work together at multiple ends to create a better internet life
- “中移链”国密引擎在BSN正式上线
- 哪个券商公司炒股开户佣金低又安全又可靠
- 【leetcode】287. Find duplicates
- TC8:UDP_ USER_ INTERFACE_ 01-08
- 新数据库时代,不要只学 Oracle、MySQL
- LVGL V8.2字符串显示在Keil MDK上需要注意的事项(以小熊派为例)
- 那个程序员,被打了。
猜你喜欢

Finally, someone made it clear what DRAM and NAND flash are

CSDN's one-stop cloud service is open for internal testing, and new and old users are sincerely invited to grab the fresh

Swift control encapsulation - paging controller

Eat a rich woman's melon...

7-Zip 遭抵制?呼吁者定下“三宗罪”:伪开源、不安全、作者来自俄罗斯!

The latest masterpiece of Alibaba, which took 182 days to produce 1015 pages of distributed full stack manual, is so delicious

Sleeping second brother...

历史上的今天:九十年代末的半导体大战;冯·诺依曼发表第一份草案;CBS 收购 CNET...

年薪100万,在北上广深买的起房子吗?

华为帐号多端协同,打造美好互联生活
随机推荐
苹果放大招!这件事干的太漂亮了……
SQL statement modify field type "suggestions collection"
渗透常用工具-Goby
PO模式深入封装
Finally, someone made it clear what DRAM and NAND flash are
炒币,亏了1000万。
超标量处理器设计 姚永斌 第4章 分支预测 --4.1 小节摘录
哪个券商公司炒股开户佣金低又安全又可靠
Win11账号被锁定无法登录怎么办?Win11账号被锁定无法登录
Some tools used in embedded development
PHP array functions (merge, split, append, find, delete, etc.)
编写自己的who命令
SQL learning notes (04) - data update and query operations
新数据库时代,不要只学 Oracle、MySQL
UE small knowledge point controller possess pawn process
If you meet a female driver and drive didi as an amateur, you can earn 500 a day!
Spark's action operator
数据中台咋就从“小甜甜”变成了“牛夫人”?
MapReduce programming basics
SQL学习笔记(01)——数据库基本知识

