Importing SVN archives - B6M1
This commit is contained in:
commit
fc4c6bd340
1695 changed files with 98617 additions and 0 deletions
legacyworlds-utils
10
legacyworlds-utils/.classpath
Normal file
10
legacyworlds-utils/.classpath
Normal file
|
@ -0,0 +1,10 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" output="target/classes" path="src/main/java"/>
|
||||
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources"/>
|
||||
<classpathentry kind="src" output="target/test-classes" path="src/test/java"/>
|
||||
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
|
||||
<classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
|
||||
<classpathentry kind="output" path="target/classes"/>
|
||||
</classpath>
|
23
legacyworlds-utils/.project
Normal file
23
legacyworlds-utils/.project
Normal file
|
@ -0,0 +1,23 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>legacyworlds-utils</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.maven.ide.eclipse.maven2Builder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
<nature>org.maven.ide.eclipse.maven2Nature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
6
legacyworlds-utils/.settings/org.eclipse.jdt.core.prefs
Normal file
6
legacyworlds-utils/.settings/org.eclipse.jdt.core.prefs
Normal file
|
@ -0,0 +1,6 @@
|
|||
#Mon Apr 19 12:23:34 CEST 2010
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
|
||||
org.eclipse.jdt.core.compiler.compliance=1.6
|
||||
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
|
||||
org.eclipse.jdt.core.compiler.source=1.6
|
9
legacyworlds-utils/.settings/org.maven.ide.eclipse.prefs
Normal file
9
legacyworlds-utils/.settings/org.maven.ide.eclipse.prefs
Normal file
|
@ -0,0 +1,9 @@
|
|||
#Mon Apr 19 12:23:33 CEST 2010
|
||||
activeProfiles=
|
||||
eclipse.preferences.version=1
|
||||
fullBuildGoals=process-test-resources
|
||||
includeModules=false
|
||||
resolveWorkspaceProjects=true
|
||||
resourceFilterGoals=process-resources resources\:testResources
|
||||
skipCompilerPlugin=true
|
||||
version=1
|
24
legacyworlds-utils/pom.xml
Normal file
24
legacyworlds-utils/pom.xml
Normal file
|
@ -0,0 +1,24 @@
|
|||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<artifactId>legacyworlds</artifactId>
|
||||
<groupId>com.deepclone.lw</groupId>
|
||||
<version>5.99.1</version>
|
||||
</parent>
|
||||
|
||||
<groupId>com.deepclone.lw</groupId>
|
||||
<artifactId>legacyworlds-utils</artifactId>
|
||||
<version>5.99.1</version>
|
||||
<name>Legacy Worlds common utilities</name>
|
||||
<description>The classes in this package are used by all parts of the Legacy Worlds code.</description>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>commons-codec</groupId>
|
||||
<artifactId>commons-codec</artifactId>
|
||||
<version>${commons.codec.version}</version>
|
||||
<type>jar</type>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
|
@ -0,0 +1,56 @@
|
|||
package com.deepclone.lw.utils;
|
||||
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.security.MessageDigest;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
|
||||
import org.apache.commons.codec.binary.Hex;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* This class provides a static method which simplies computing hex-encoded digests of strings using
|
||||
* some hashing algorithm.
|
||||
*
|
||||
* @author tseeker
|
||||
*/
|
||||
public final class DigestHelper
|
||||
{
|
||||
|
||||
private DigestHelper( )
|
||||
{
|
||||
// EMPTY
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This method computes a hex-encoded digest of a string using the specified algorithm.
|
||||
*
|
||||
* @param algo
|
||||
* the digest algorithm to use
|
||||
* @param source
|
||||
* the string to digest
|
||||
* @return the hex-encoded digest
|
||||
*/
|
||||
public static String digest( String algo , String source )
|
||||
{
|
||||
// Create digest
|
||||
MessageDigest digestAlgorithm;
|
||||
try {
|
||||
digestAlgorithm = MessageDigest.getInstance( algo );
|
||||
} catch ( NoSuchAlgorithmException e ) {
|
||||
throw new RuntimeException( "'" + algo + "' digest not supported" );
|
||||
}
|
||||
// Add data
|
||||
try {
|
||||
digestAlgorithm.update( source.getBytes( "UTF-8" ) );
|
||||
} catch ( UnsupportedEncodingException e ) {
|
||||
throw new RuntimeException( "UTF-8 not supported? I must be dreaming." );
|
||||
}
|
||||
// Compute digest and return its hexadecimal encoding
|
||||
byte[] digest = digestAlgorithm.digest( );
|
||||
return Hex.encodeHexString( digest );
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue