Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
9735dcf9
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1187
Star
22018
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
9735dcf9
编写于
2月 28, 2022
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
md5
上级
17dfbffb
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
22 addition
and
12 deletion
+22
-12
include/util/tmd5.h
include/util/tmd5.h
+11
-1
source/util/src/tmd5.c
source/util/src/tmd5.c
+11
-11
未找到文件。
include/util/tmd5.h
浏览文件 @
9735dcf9
...
...
@@ -25,6 +25,12 @@
#ifndef _TD_UTIL_MD5_H
#define _TD_UTIL_MD5_H
#include "os.h"
#ifdef __cplusplus
extern
"C"
{
#endif
typedef
struct
{
uint32_t
i
[
2
];
/* number of _bits_ handled mod 2^64 */
uint32_t
buf
[
4
];
/* scratch buffer */
...
...
@@ -33,7 +39,11 @@ typedef struct {
}
T_MD5_CTX
;
void
tMD5Init
(
T_MD5_CTX
*
mdContext
);
void
tMD5Update
(
T_MD5_CTX
*
mdContext
,
uint8_t
*
inBuf
,
u
nsigned
in
t
inLen
);
void
tMD5Update
(
T_MD5_CTX
*
mdContext
,
uint8_t
*
inBuf
,
u
int32_
t
inLen
);
void
tMD5Final
(
T_MD5_CTX
*
mdContext
);
#ifdef __cplusplus
}
#endif
#endif
/*_TD_UTIL_MD5_H*/
source/util/src/tmd5.c
浏览文件 @
9735dcf9
...
...
@@ -33,7 +33,7 @@
***********************************************************************
*/
#
include "os.h"
#
define _DEFAULT_SOURCE
#include "tmd5.h"
/* forward declaration */
...
...
@@ -98,13 +98,13 @@ void tMD5Init(T_MD5_CTX *mdContext) {
account for the presence of each of the characters inBuf[0..inLen-1]
in the message whose digest is being computed.
*/
void
tMD5Update
(
T_MD5_CTX
*
mdContext
,
uint8_t
*
inBuf
,
u
nsigned
in
t
inLen
)
{
uint32_t
in
[
16
];
int
mdi
;
u
nsigned
in
t
i
,
ii
;
void
tMD5Update
(
T_MD5_CTX
*
mdContext
,
uint8_t
*
inBuf
,
u
int32_
t
inLen
)
{
uint32_t
in
[
16
];
uint32_t
mdi
;
u
int32_
t
i
,
ii
;
/* compute number of bytes mod 64 */
mdi
=
(
in
t
)((
mdContext
->
i
[
0
]
>>
3
)
&
0x3F
);
mdi
=
(
uint32_
t
)((
mdContext
->
i
[
0
]
>>
3
)
&
0x3F
);
/* update number of bits */
if
((
mdContext
->
i
[
0
]
+
((
uint32_t
)
inLen
<<
3
))
<
mdContext
->
i
[
0
])
mdContext
->
i
[
1
]
++
;
...
...
@@ -130,17 +130,17 @@ void tMD5Update(T_MD5_CTX *mdContext, uint8_t *inBuf, unsigned int inLen) {
ends with the desired message digest in mdContext->digest[0...15].
*/
void
tMD5Final
(
T_MD5_CTX
*
mdContext
)
{
uint32_t
in
[
16
];
int
mdi
;
u
nsigned
in
t
i
,
ii
;
u
nsigned
in
t
padLen
;
uint32_t
in
[
16
];
uint32_t
mdi
;
u
int32_
t
i
,
ii
;
u
int32_
t
padLen
;
/* save number of bits */
in
[
14
]
=
mdContext
->
i
[
0
];
in
[
15
]
=
mdContext
->
i
[
1
];
/* compute number of bytes mod 64 */
mdi
=
(
in
t
)((
mdContext
->
i
[
0
]
>>
3
)
&
0x3F
);
mdi
=
(
uint32_
t
)((
mdContext
->
i
[
0
]
>>
3
)
&
0x3F
);
/* pad out to 56 mod 64 */
padLen
=
(
mdi
<
56
)
?
(
56
-
mdi
)
:
(
120
-
mdi
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录