chenf99 blog


  • 首页

  • 关于

  • 归档

  • 搜索

MD5算法实现

发表于 2018-12-07 | 更新于: 2019-07-19
字数统计: 2.7k 字

本文阐述MD5算法的基本原理及其C++实现方法,并给出源代码

算法原理概述

MD5即Message-Digest Algorithm 5 (信息-摘要算法 5) ,是一种被广泛使用的密码散列(hash)函数,它使用小端模式,输入任意不定长的消息,产生的是128位(16个字节)的散列值(hash value),用于确保信息传输的完整性和一致性。

MD5算法不是足够安全的,可以找到两个不同的512位的块,它们通过的MD5的hash值相同

但对于有意义的消息,还没有两个不同的消息,它们的MD5的hash值相同

阅读全文 »

leetcode-210

发表于 2018-11-30 | 更新于: 2018-11-30 | 分类于 leetcode
字数统计: 1.4k 字

题目

Course Schedule II

There are a total of n courses you have to take, labeled from 0 to n-1.

Some courses may have prerequisites, for example to take course 0 you have to first take course 1, which is expressed as a pair: [0,1]

Given the total number of courses and a list of prerequisite pairs, return the ordering of courses you should take to finish all courses.

There may be multiple correct orders, you just need to return one of them. If it is impossible to finish all courses, return an empty array.

阅读全文 »

leetcode-085

发表于 2018-11-24 | 更新于: 2018-11-25 | 分类于 leetcode
字数统计: 1k 字

上周做完Largest Rectangle in Histogram后leetcode推荐我接下来做这一题,因此本周算法题就选它了。

题目

Maximal Rectangle

Given a 2D binary matrix filled with 0’s and 1’s, find the largest rectangle containing only 1’s and return its area.

Example:

1
2
3
4
5
6
7
8
9
> Input:
> [
> ["1","0","1","0","0"],
> ["1","0","1","1","1"],
> ["1","1","1","1","1"],
> ["1","0","0","1","0"]
> ]
> Output: 6
>
阅读全文 »
1…345…10
Chenf99

Chenf99

30 日志
6 分类
10 标签
© 2019 Chenf99
总访客数: 总访问量:
本站共计64.3k字