1. Project Clover database Tue Dec 20 2016 21:24:09 CET
  2. Package org.xwiki.crypto.params.cipher.symmetric

File RC2KeyParameters.java

 

Coverage histogram

../../../../../../img/srcFileCovDistChart5.png
74% of files have more coverage

Code metrics

2
5
3
1
62
19
4
0.8
1.67
3
1.33

Classes

Class Line # Actions
RC2KeyParameters 28 5 0% 4 5
0.550%
 

Contributing tests

This file is covered by 3 tests. .

Source view

1    /*
2    * See the NOTICE file distributed with this work for additional
3    * information regarding copyright ownership.
4    *
5    * This is free software; you can redistribute it and/or modify it
6    * under the terms of the GNU Lesser General Public License as
7    * published by the Free Software Foundation; either version 2.1 of
8    * the License, or (at your option) any later version.
9    *
10    * This software is distributed in the hope that it will be useful,
11    * but WITHOUT ANY WARRANTY; without even the implied warranty of
12    * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13    * Lesser General Public License for more details.
14    *
15    * You should have received a copy of the GNU Lesser General Public
16    * License along with this software; if not, write to the Free
17    * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
18    * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
19    */
20    package org.xwiki.crypto.params.cipher.symmetric;
21   
22    /**
23    * Derived version of key parameters to specify effective key bits of RC2.
24    *
25    * @version $Id: e3e739671907d87d2d6781192983e4137983b259 $
26    * @since 5.4M1
27    */
 
28    public class RC2KeyParameters extends KeyParameter
29    {
30    private final int bits;
31   
32    /**
33    * Initialize parameters.
34    *
35    * @param key the key, all bits are considered effective.
36    */
 
37  0 toggle public RC2KeyParameters(byte[] key)
38    {
39  0 super(key);
40  0 this.bits = (key.length > 128) ? 1024 : (key.length * 8);
41    }
42   
43    /**
44    * Initialize parameters.
45    *
46    * @param key the key.
47    * @param bits the number of effective bits in the key.
48    */
 
49  4 toggle public RC2KeyParameters(byte[] key, int bits)
50    {
51  4 super(key);
52  4 this.bits = bits;
53    }
54   
55    /**
56    * @return the number of effective bits that should be used for the key.
57    */
 
58  4 toggle public int getEffectiveBits()
59    {
60  4 return this.bits;
61    }
62    }