package net.yasme.android.encryption;

import android.util.Log;

import java.security.MessageDigest;

/**
 * Created by Marco Eberl on 27.07.2014.
 */
public class PasswordEncryption {

    private static final String HASH_ALG = "SHA-512";

    public String securePassword(String password){
        return "test";
    }

    public byte[] hash(String password){
       try {
           MessageDigest md;
           md = MessageDigest.getInstance("SHA-512");
           byte[] sha1hash = new byte[40];
           md.update(password.getBytes("UTF-8"));
           sha1hash = md.digest();
           return sha1hash;
       }
       catch (Exception e){
           Log.d(this.getClass().getSimpleName(), "[???] Hashing Password failed");
           Log.d(this.getClass().getSimpleName(), "[???] Error: " + e.getMessage());
       }
       return null;
    }

}

@@ -58,24 +58,85 @@
 til.Log;%0D%0A%0D%0A
+import org.codehaus.jackson.map.deser.ValueInstantiators;%0D%0A%0D%0A
 import java.
@@ -246,16 +246,30 @@
 ryption 
+extends Base64
 %7B%0D%0A%0D%0A   
@@ -318,24 +318,67 @@
 HA-512%22;%0D%0A%0D%0A
+    //protect against Bruto-Force-Attacks%0D%0A
     public S
@@ -436,14 +436,24 @@
 urn 
-%22test%22
+SHA512(password)
 ;%0D%0A 
@@ -475,19 +475,21 @@
 lic 
-byte%5B%5D hash
+String SHA512
 (Str
@@ -621,20 +621,16 @@
  byte%5B%5D 
-sha1
 hash = n
@@ -705,20 +705,16 @@
         
-sha1
 hash = m
@@ -748,16 +748,26 @@
 urn 
-sha1
+base64Encode(
 hash
+)
 ;%0D%0A 
@@ -1015,11 +1015,15 @@
    %7D%0D%0A%0D%0A
+%0D%0A%0D%0A
 %7D%0D%0A

add PasswortEncryption