当前位置:网站首页>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();
边栏推荐
- 电脑USB、HDMI、DP各种接口及速度
- 树莓派4B系统搭建(超详细版)
- Flinkv1.13 implementation of financial anti fraud cases
- 吃一个女富豪的瓜。。。
- 121. thread scheduling: join() method and yield() method
- 怎么理解JS Promise
- Clickhouse: Test on query speed of A-share minute data [Part 2]
- Write your own who commands
- 7-Zip boycotted? The callers have committed "three crimes": pseudo open source, unsafe, and the author is from Russia!
- PHP code audit and File Inclusion Vulnerability
猜你喜欢

渗透常用工具-Goby

scratch大鱼吃小鱼 电子学会图形化编程scratch等级考试二级真题和答案解析2022年6月

HMS Core音频编辑服务3D音频技术,助力打造沉浸式听觉盛宴

Strange, why is the ArrayList initialization capacity size 10?

嵌入式开发用到的一些工具
![Clickhouse: Test on query speed of A-share minute data [Part 2]](/img/c8/42ba748d38546d3b0d2be9b33c5d0b.jpg)
Clickhouse: Test on query speed of A-share minute data [Part 2]

Module 9: design e-commerce seckill system

Swift control encapsulation - paging controller

谁还在买“三只松鼠”们

MapReduce programming basics
随机推荐
Spark's action operator
The programmer was beaten.
吃一个女富豪的瓜。。。
HMS Core音频编辑服务3D音频技术,助力打造沉浸式听觉盛宴
UE small knowledge point controller possess pawn process
SQL learning notes (03) -- data constraint relationship
TC8:UDP_USER_INTERFACE_01-08
uniapp微信小程序组件按需引入
[unity rendering] customized screen post-processing
MySQL interception_ MySQL method for intercepting strings [easy to understand]
渗透常用工具-Goby
SQL学习笔记(01)——数据库基本知识
The market is relatively weak recently
Tearful eyes, it's not easy to change jobs. Three rounds of interviews, four hours of soul torture
The latest masterpiece of Alibaba, which took 182 days to produce 1015 pages of distributed full stack manual, is so delicious
How to understand JS promise
我喜欢两个男人。。。
Mikrotik Routeros Internet access settings
Project procurement management
架构实战营 模块九:设计电商秒杀系统

