Welcome to mirror list, hosted at ThFree Co, Russian Federation.

Threefish.java « symmetric « provider « jcajce « spongycastle « org « java « main « src « prov - gitlab.com/quite/humla-spongycastle.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 49e4d1b15eb92068c894cfa4ad461f317477f96e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
package org.spongycastle.jcajce.provider.symmetric;

import org.spongycastle.crypto.CipherKeyGenerator;
import org.spongycastle.crypto.engines.ThreefishEngine;
import org.spongycastle.jcajce.provider.config.ConfigurableProvider;
import org.spongycastle.jcajce.provider.symmetric.util.BaseBlockCipher;
import org.spongycastle.jcajce.provider.symmetric.util.BaseKeyGenerator;
import org.spongycastle.jcajce.provider.symmetric.util.IvAlgorithmParameters;
import org.spongycastle.jcajce.provider.util.AlgorithmProvider;

public final class Threefish
{
    private Threefish()
    {
    }

    public static class ECB_256
        extends BaseBlockCipher
    {
        public ECB_256()
        {
            super(new ThreefishEngine(ThreefishEngine.BLOCKSIZE_256));
        }
    }

    public static class ECB_512
        extends BaseBlockCipher
    {
        public ECB_512()
        {
            super(new ThreefishEngine(ThreefishEngine.BLOCKSIZE_512));
        }
    }

    public static class ECB_1024
        extends BaseBlockCipher
    {
        public ECB_1024()
        {
            super(new ThreefishEngine(ThreefishEngine.BLOCKSIZE_1024));
        }
    }

    public static class KeyGen_256
        extends BaseKeyGenerator
    {
        public KeyGen_256()
        {
            super("Threefish-256", 256, new CipherKeyGenerator());
        }
    }

    public static class KeyGen_512
        extends BaseKeyGenerator
    {
        public KeyGen_512()
        {
            super("Threefish-512", 512, new CipherKeyGenerator());
        }
    }

    public static class KeyGen_1024
        extends BaseKeyGenerator
    {
        public KeyGen_1024()
        {
            super("Threefish-1024", 1024, new CipherKeyGenerator());
        }
    }

    public static class AlgParams_256
        extends IvAlgorithmParameters
    {
        protected String engineToString()
        {
            return "Threefish-256 IV";
        }
    }

    public static class AlgParams_512
        extends IvAlgorithmParameters
    {
        protected String engineToString()
        {
            return "Threefish-512 IV";
        }
    }

    public static class AlgParams_1024
        extends IvAlgorithmParameters
    {
        protected String engineToString()
        {
            return "Threefish-1024 IV";
        }
    }

    public static class Mappings
        extends AlgorithmProvider
    {
        private static final String PREFIX = Threefish.class.getName();

        public Mappings()
        {
        }

        public void configure(ConfigurableProvider provider)
        {
            provider.addAlgorithm("Cipher.Threefish-256", PREFIX + "$ECB_256");
            provider.addAlgorithm("Cipher.Threefish-512", PREFIX + "$ECB_512");
            provider.addAlgorithm("Cipher.Threefish-1024", PREFIX + "$ECB_1024");
            provider.addAlgorithm("KeyGenerator.Threefish-256", PREFIX + "$KeyGen_256");
            provider.addAlgorithm("KeyGenerator.Threefish-512", PREFIX + "$KeyGen_512");
            provider.addAlgorithm("KeyGenerator.Threefish-1024", PREFIX + "$KeyGen_1024");
            provider.addAlgorithm("AlgorithmParameters.Threefish-256", PREFIX + "$AlgParams_256");
            provider.addAlgorithm("AlgorithmParameters.Threefish-512", PREFIX + "$AlgParams_512");
            provider.addAlgorithm("AlgorithmParameters.Threefish-1024", PREFIX + "$AlgParams_1024");
        }
    }
}