javax.crypto.spec.RC5ParameterSpec Java Examples

The following examples show how to use javax.crypto.spec.RC5ParameterSpec. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: RC5ParameterSpecTest.java    From j2objc with Apache License 2.0 5 votes vote down vote up
/**
 * getVersion() method testing. Tests that returned value is
 * equal to the value specified in the constructor.
 */
public void testGetVersion() {
    int version = 1;
    int rounds = 5;
    int wordSize = 16;

    RC5ParameterSpec ps = new RC5ParameterSpec(version, rounds, wordSize);
    assertTrue("The returned version value should be equal to the "
            + "value specified in the constructor.",
            ps.getVersion() == version);
}
 
Example #2
Source File: RC5ParameterSpecTest.java    From j2objc with Apache License 2.0 5 votes vote down vote up
/**
 * getRounds() method testing. Tests that returned value is
 * equal to the value specified in the constructor.
 */
public void testGetRounds() {
    int version = 1;
    int rounds = 5;
    int wordSize = 16;

    RC5ParameterSpec ps = new RC5ParameterSpec(version, rounds, wordSize);
    assertTrue("The returned rounds value should be equal to the "
            + "value specified in the constructor.",
            ps.getRounds() == rounds);
}
 
Example #3
Source File: RC5ParameterSpecTest.java    From j2objc with Apache License 2.0 5 votes vote down vote up
/**
 * getWordSize() method testing. Tests that returned value is
 * equal to the value specified in the constructor.
 */
public void testGetWordSize() {
    int version = 1;
    int rounds = 5;
    int wordSize = 16;

    RC5ParameterSpec ps = new RC5ParameterSpec(version, rounds, wordSize);
    assertTrue("The returned wordSize value should be equal to the "
            + "value specified in the constructor.",
            ps.getWordSize() == wordSize);
}
 
Example #4
Source File: RC5ParameterSpecTest.java    From j2objc with Apache License 2.0 5 votes vote down vote up
/**
 * hashCode() method testing. Tests that for equal objects hash codes
 * are equal.
 */
public void testHashCode() {
    int version = 1;
    int rounds = 5;
    int wordSize = 16;
    byte[] iv = {1, 2, 3, 4, 5, 6};

    RC5ParameterSpec ps1 = new RC5ParameterSpec(version, rounds,
                                                            wordSize, iv);
    RC5ParameterSpec ps2 = new RC5ParameterSpec(version, rounds,
                                                            wordSize, iv);
    assertTrue("Equal objects should have the same hash codes.",
                                        ps1.hashCode() == ps2.hashCode());
}
 
Example #5
Source File: RC5ParameterSpecTest.java    From j2objc with Apache License 2.0 5 votes vote down vote up
public void test_constructorIII() {
    int version = 1;
    int rounds = 5;
    int wordSize = 16;
    RC5ParameterSpec ps1 = new RC5ParameterSpec(version, rounds, wordSize);
    RC5ParameterSpec ps2 = new RC5ParameterSpec(version, rounds, wordSize);
    RC5ParameterSpec ps3 = new RC5ParameterSpec(version, rounds, wordSize + 1);

    assertTrue(ps1.equals(ps2));
    assertFalse(ps1.equals(ps3));
}