package org.ggp.base.util.crypto; import org.junit.Assert; import org.junit.Test; /** * Unit tests for the BaseHashing class, which implements some utility * functions for cryptographic hashing in GGP. * * @author Sam */ public class BaseHashingTest extends Assert { @Test public void testHashesAreExpected() throws Exception { // Hash codes generated by "computeSHA1Hash" are persisted in several places. // It's important that we not change this hash function, or systems that depend // on these persisted hash codes will break in unexpected ways. This test is set // up to fail if the hashing algorithm ever changes. assertEquals(BaseHashing.computeSHA1Hash("hello world"), "2aae6c35c94fcfb415dbe95f408b9ce91ee846ed"); assertEquals(BaseHashing.computeSHA1Hash("12345678901"), "266dc053a8163e676e83243070241c8917f8a8a3"); } }