131c75014Sopenharmony_ci/*
231c75014Sopenharmony_ci * Copyright (c) 2021 Huawei Device Co., Ltd.
331c75014Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
431c75014Sopenharmony_ci * you may not use this file except in compliance with the License.
531c75014Sopenharmony_ci * You may obtain a copy of the License at
631c75014Sopenharmony_ci *
731c75014Sopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
831c75014Sopenharmony_ci *
931c75014Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software
1031c75014Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
1131c75014Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1231c75014Sopenharmony_ci * See the License for the specific language governing permissions and
1331c75014Sopenharmony_ci * limitations under the License.
1431c75014Sopenharmony_ci */
1531c75014Sopenharmony_ci
1631c75014Sopenharmony_ci/*
1731c75014Sopenharmony_ci * Description: 计算文件SHA256校验和的基本方法
1831c75014Sopenharmony_ci */
1931c75014Sopenharmony_ci
2031c75014Sopenharmony_ci#ifndef CHECKSUM_SHA256_H
2131c75014Sopenharmony_ci#define CHECKSUM_SHA256_H
2231c75014Sopenharmony_ci
2331c75014Sopenharmony_ci// 信息摘要结构体
2431c75014Sopenharmony_citypedef struct {
2531c75014Sopenharmony_ci    unsigned char data[64]; // 消息数据块
2631c75014Sopenharmony_ci    unsigned int dataLen; // 消息数据块长度
2731c75014Sopenharmony_ci    unsigned long long bitLen; // 信息的字节长度
2831c75014Sopenharmony_ci    unsigned int hash[8]; // 哈希值
2931c75014Sopenharmony_ci} MesgDigest;
3031c75014Sopenharmony_ci
3131c75014Sopenharmony_civoid InitSha256(MesgDigest *md);
3231c75014Sopenharmony_civoid CalcSha256(MesgDigest *md, unsigned char *mesg);
3331c75014Sopenharmony_ci
3431c75014Sopenharmony_ci#endif // CHECKSUM_SHA256_H
35