• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java Grain128Engine类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.bouncycastle.crypto.engines.Grain128Engine的典型用法代码示例。如果您正苦于以下问题:Java Grain128Engine类的具体用法?Java Grain128Engine怎么用?Java Grain128Engine使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Grain128Engine类属于org.bouncycastle.crypto.engines包,在下文中一共展示了Grain128Engine类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: Grain128Test1

import org.bouncycastle.crypto.engines.Grain128Engine; //导入依赖的package包/类
private void Grain128Test1(CipherParameters params)
{
    StreamCipher grain = new Grain128Engine();
    byte[] in = new byte[16];
    byte[] out = new byte[16];

    grain.init(true, params);

    grain.processBytes(in, 0, in.length, out, 0);

    if (!areEqual(out, Hex.decode(keyStream1)))
    {
        mismatch("Keystream 1", keyStream1, out);
    }

    grain.reset();

    grain.processBytes(in, 0, in.length, out, 0);

    if (!areEqual(out, Hex.decode(keyStream1)))
    {
        mismatch("Keystream 1", keyStream1, out);
    }
}
 
开发者ID:ttt43ttt,项目名称:gwt-crypto,代码行数:25,代码来源:Grain128Test.java


示例2: Grain128Test2

import org.bouncycastle.crypto.engines.Grain128Engine; //导入依赖的package包/类
private void Grain128Test2(CipherParameters params)
{
    StreamCipher grain = new Grain128Engine();
    byte[] in = new byte[16];
    byte[] out = new byte[16];

    grain.init(true, params);

    grain.processBytes(in, 0, in.length, out, 0);

    if (!areEqual(out, Hex.decode(keyStream2)))
    {
        mismatch("Keystream 2", keyStream2, out);
    }

    grain.reset();

    grain.processBytes(in, 0, in.length, out, 0);

    if (!areEqual(out, Hex.decode(keyStream2)))
    {
        mismatch("Keystream 2", keyStream2, out);
    }
}
 
开发者ID:ttt43ttt,项目名称:gwt-crypto,代码行数:25,代码来源:Grain128Test.java


示例3: Grain128Test3

import org.bouncycastle.crypto.engines.Grain128Engine; //导入依赖的package包/类
private void Grain128Test3(CipherParameters params)
{
    StreamCipher grain = new Grain128Engine();
    byte[] in = "Encrypt me!".getBytes();
    byte[] cipher = new byte[in.length];
    byte[] clear = new byte[in.length];

    grain.init(true, params);

    grain.processBytes(in, 0, in.length, cipher, 0);
    grain.reset();
    grain.processBytes(cipher, 0, cipher.length, clear, 0);

    if (!areEqual(in, clear))
    {
        mismatch("Test 3", new String(Hex.encode(in)), clear);
    }
}
 
开发者ID:ttt43ttt,项目名称:gwt-crypto,代码行数:19,代码来源:Grain128Test.java


示例4: performTest

import org.bouncycastle.crypto.engines.Grain128Engine; //导入依赖的package包/类
public void performTest()
    throws Exception
{
    testReset(new Salsa20Engine(), new Salsa20Engine(), new ParametersWithIV(new KeyParameter(random(32)),
        random(8)));
    testReset(new Salsa20Engine(), new Salsa20Engine(), new ParametersWithIV(new KeyParameter(random(16)),
        random(8)));
    testReset(new XSalsa20Engine(), new XSalsa20Engine(), new ParametersWithIV(new KeyParameter(random(32)),
        random(24)));
    testReset(new ChaChaEngine(), new ChaChaEngine(), new ParametersWithIV(new KeyParameter(random(32)), random(8)));
    testReset(new ChaChaEngine(), new ChaChaEngine(), new ParametersWithIV(new KeyParameter(random(16)), random(8)));
    testReset(new RC4Engine(), new RC4Engine(), new KeyParameter(random(16)));
    testReset(new ISAACEngine(), new ISAACEngine(), new KeyParameter(random(16)));
    testReset(new HC128Engine(), new HC128Engine(), new ParametersWithIV(new KeyParameter(random(16)), random(16)));
    testReset(new HC256Engine(), new HC256Engine(), new ParametersWithIV(new KeyParameter(random(16)), random(16)));
    testReset(new Grainv1Engine(), new Grainv1Engine(), new ParametersWithIV(new KeyParameter(random(16)),
        random(8)));
    testReset(new Grain128Engine(), new Grain128Engine(), new ParametersWithIV(new KeyParameter(random(16)),
        random(12)));
}
 
开发者ID:ttt43ttt,项目名称:gwt-crypto,代码行数:21,代码来源:StreamCipherResetTest.java


示例5: getIVSize

import org.bouncycastle.crypto.engines.Grain128Engine; //导入依赖的package包/类
@Override
public int getIVSize()
{
	if (ivSize < 0) {
		if (delegate instanceof Grainv1Engine)
			ivSize = 8;
		else if (delegate instanceof Grain128Engine)
			ivSize = 12;
		else if (delegate instanceof HC128Engine)
			ivSize = 16;
		else if (delegate instanceof HC256Engine)
			ivSize = 32;
		else if (delegate instanceof ISAACEngine)
			ivSize = 0;
		else if (delegate instanceof RC4Engine)
			ivSize = 0;
		else if (delegate instanceof Salsa20Engine)
			ivSize = 8;
		else
			throw new UnsupportedOperationException("For this delegate cipher type, this operation is not yet supported!");
	}
	return ivSize;
}
 
开发者ID:subshare,项目名称:subshare,代码行数:24,代码来源:StreamCipherImpl.java


示例6: performTests

import org.bouncycastle.crypto.engines.Grain128Engine; //导入依赖的package包/类
private void performTests()
    throws Exception
{
    testModes(new BlowfishEngine(), new BlowfishEngine(), 16);
    testModes(new DESEngine(), new DESEngine(), 8);
    testModes(new DESedeEngine(), new DESedeEngine(), 24);
    testModes(new TEAEngine(), new TEAEngine(), 16);
    testModes(new CAST5Engine(), new CAST5Engine(), 16);
    testModes(new RC2Engine(), new RC2Engine(), 16);
    testModes(new XTEAEngine(), new XTEAEngine(), 16);

    testModes(new AESEngine(), new AESEngine(), 16);
    testModes(new NoekeonEngine(), new NoekeonEngine(), 16);
    testModes(new TwofishEngine(), new TwofishEngine(), 16);
    testModes(new CAST6Engine(), new CAST6Engine(), 16);
    testModes(new SEEDEngine(), new SEEDEngine(), 16);
    testModes(new SerpentEngine(), new SerpentEngine(), 16);
    testModes(new RC6Engine(), new RC6Engine(), 16);
    testModes(new CamelliaEngine(), new CamelliaEngine(), 16);
    testModes(new ThreefishEngine(ThreefishEngine.BLOCKSIZE_512),
        new ThreefishEngine(ThreefishEngine.BLOCKSIZE_512), 64);

    testMode(new RC4Engine(), new KeyParameter(new byte[16]));
    testMode(new Salsa20Engine(), new ParametersWithIV(new KeyParameter(new byte[16]), new byte[8]));
    testMode(new XSalsa20Engine(), new ParametersWithIV(new KeyParameter(new byte[32]), new byte[24]));
    testMode(new ChaChaEngine(), new ParametersWithIV(new KeyParameter(new byte[16]), new byte[8]));
    testMode(new Grainv1Engine(), new ParametersWithIV(new KeyParameter(new byte[16]), new byte[8]));
    testMode(new Grain128Engine(), new ParametersWithIV(new KeyParameter(new byte[16]), new byte[12]));
    testMode(new HC128Engine(), new KeyParameter(new byte[16]));
    testMode(new HC256Engine(), new ParametersWithIV(new KeyParameter(new byte[16]), new byte[16]));

    testSkipping(new Salsa20Engine(), new ParametersWithIV(new KeyParameter(new byte[16]), new byte[8]));
    testSkipping(new SICBlockCipher(new AESEngine()), new ParametersWithIV(new KeyParameter(new byte[16]), new byte[16]));
}
 
开发者ID:ttt43ttt,项目名称:gwt-crypto,代码行数:35,代码来源:CipherStreamTest.java


示例7: Base

import org.bouncycastle.crypto.engines.Grain128Engine; //导入依赖的package包/类
public Base()
{
    super(new Grain128Engine(), 12);
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:5,代码来源:Grain128.java



注:本文中的org.bouncycastle.crypto.engines.Grain128Engine类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ModuleExtension类代码示例发布时间:2022-05-23
下一篇:
Java Boost类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap