资源简介
实现国密SM3算法验证和SM4算法CBC模式下文件加密操作,基于.net环境VS2017开发。

代码片段和文件信息
using System;
using Org.BouncyCastle.Crypto;
namespace HmH.base.SmHelper.cipher
{
public abstract class GeneralDigest : IDigest
{
private const int BYTE_LENGTH = 64;
private byte[] xBuf;
private int xBufOff;
private long byteCount;
internal GeneralDigest()
{
xBuf = new byte[4];
}
internal GeneralDigest(GeneralDigest t)
{
xBuf = new byte[t.xBuf.Length];
Array.Copy(t.xBuf 0 xBuf 0 t.xBuf.Length);
xBufOff = t.xBufOff;
byteCount = t.byteCount;
}
public void Update(byte input)
{
xBuf[xBufOff++] = input;
if (xBufOff == xBuf.Length)
{
ProcessWord(xBuf 0);
xBufOff = 0;
}
byteCount++;
}
public void BlockUpdate(
byte[] input
int inOff
int length)
{
//
// fill the current word
//
while ((xBufOff != 0) && (length > 0))
{
Update(input[inOff]);
inOff++;
length--;
}
//
// process whole words.
//
while (length > xBuf.Length)
{
ProcessWord(input inOff);
inOff += xBuf.Length;
length -= xBuf.Length;
byteCount += xBuf.Length;
}
//
// load in the remainder.
//
while (length > 0)
{
Update(input[inOff]);
inOff++;
length--;
}
}
public void Finish()
{
long bitLength = (byteCount << 3);
//
// add the pad bytes.
//
Update(unchecked((byte)128));
while (xBufOff != 0) Update(unchecked((byte)0));
ProcessLength(bitLength);
ProcessBlock();
}
public virtual void Reset()
{
byteCount = 0;
xBufOff = 0;
Array.Clear(xBuf 0 xBuf.Length);
}
public int GetByteLength()
{
return BYTE_LENGTH;
}
internal abstract void ProcessWord(byte[] input int inOff);
internal abstract void ProcessLength(long bitLength);
internal abstract void ProcessBlock();
public abstract string AlgorithmName { get; }
public abstract int GetDigestSize();
public abstract int DoFinal(byte[] output int outOff);
}
public class SupportClass
{
///
/// Performs an unsigned bitwise right shift with the specified number
///
///Number to operate on
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 2277376 2019-01-15 16:05 smHelper\bin\Debug\BouncyCastle.dll
文件 1453726 2019-01-15 16:05 smHelper\bin\Debug\BouncyCastle.xm
文件 13312 2019-01-16 17:58 smHelper\bin\Debug\SmHelper.dll
文件 38400 2019-01-16 17:58 smHelper\bin\Debug\SmHelper.pdb
文件 10648 2019-01-16 17:41 smHelper\cipher\SM3Digest.cs
文件 14323 2019-01-16 17:30 smHelper\cipher\SM4.cs
文件 3565 2019-01-16 16:23 smHelper\cipher\SM4Utils.cs
文件 620 2019-01-16 16:18 smHelper\cipher\SM4_Context.cs
文件 5831 2019-01-16 17:31 smHelper\obj\Debug\DesignTimeResolveAssemblyReferencesInput.cache
文件 0 2019-01-16 17:58 smHelper\obj\Debug\smHelper.csproj.CopyComplete
文件 42 2019-01-16 17:31 smHelper\obj\Debug\smHelper.csproj.CoreCompileInputs.cache
文件 580 2019-01-16 17:29 smHelper\obj\Debug\smHelper.csproj.FileListAbsolute.txt
文件 4451 2019-01-16 17:29 smHelper\obj\Debug\smHelper.csprojResolveAssemblyReference.cache
文件 13312 2019-01-16 17:58 smHelper\obj\Debug\SmHelper.dll
文件 38400 2019-01-16 17:58 smHelper\obj\Debug\SmHelper.pdb
文件 1305 2019-01-10 16:59 smHelper\Properties\AssemblyInfo.cs
文件 2199 2019-01-16 17:58 smHelper\smHelper.csproj
文件 2277376 2019-01-15 16:05 smTools\bin\Debug\BouncyCastle.dll
文件 1453726 2019-01-15 16:05 smTools\bin\Debug\BouncyCastle.xm
文件 13312 2019-01-16 17:58 smTools\bin\Debug\SmHelper.dll
文件 38400 2019-01-16 17:58 smTools\bin\Debug\SmHelper.pdb
文件 12800 2019-01-16 18:13 smTools\bin\Debug\SmTools.exe
文件 24064 2019-01-16 18:13 smTools\bin\Debug\SmTools.pdb
文件 8772 2019-01-16 18:13 smTools\Form1.cs
文件 7898 2019-01-16 17:24 smTools\Form1.Designer.cs
文件 5817 2019-01-16 17:24 smTools\Form1.resx
文件 1230 2019-01-10 17:56 smTools\obj\Debug\DesignTimeResolveAssemblyReferences.cache
文件 6189 2019-01-16 18:12 smTools\obj\Debug\DesignTimeResolveAssemblyReferencesInput.cache
文件 180 2019-01-16 18:13 smTools\obj\Debug\HmH.Form.SmTools.Properties.Resources.resources
文件 0 2019-01-16 18:13 smTools\obj\Debug\smTools.csproj.CopyComplete
............此处省略36个文件信息
相关资源
- DV泵加罗茨泵独立控制系统PID.smart
- 200smart单按钮启停.smart
- 微软masm汇编编译器
- ASUS BIOS 加NVME协议文件: Nvme.ffs NV
- SSM+Shiro+redis实现单点登陆
- CSMA/CD等动画演示加源代码
- 汇编之masm6.11
- SIM908 SDIO FSMC STM32 FIFO
- 单片机AT89s52控制GSM模块TC35i发短信,
- Bochs入门教程[操作系统第一步]
- PDSmaker 辩论赛赛制模板文件制作工具
- 汇编语言编译器masm5.0
- SMAC用户详解手册
- 8051F040SMBUS多机通信
- uCOS编译环境建立 BC45 TASM
- 基于SSM+CXF构建的RESTFul webservice
- masm 6.14安装版
- nasm-2.15-x64
- 范例153 制作员工花名册.xlsm
- 西门子smart200 485通讯有注释.smart
- OMRON NJ系列PLC程序.smc2
- 西数硬盘清零工具可以复位smart
- ssm框架登录注册demo
- smart和labview通讯(smart_connet.vi)
- 200SMART Modbus-TCP通信程序演示-轮询(多
- 西门子s7-200smart换热站控制程序.smar
- S7-200 SMART Profinet IO程序
- 使用ATLAS检测器,在s = 7 TeV的pp碰撞中
- MSSM中双光子共振的增强速率
- 使用W→ντ→νa1→π∓
评论
共有 条评论