package com.github.emboss.siphash;

/**
 * 
 * @author <a href="mailto:Martin.Bosslet@googlemail.com">Martin Bosslet</a>
 */
public class SipKey {
    private final byte[] key;
    
    public SipKey(byte[] key) {
        if (key == null || key.length != 16)
            throw new RuntimeException("SipHash key must be 16 bytes");
        this.key = key;
    }
    
    long getLeftHalf() {
       return UnsignedInt64.binToIntOffset(key, 0); 
    }
    
    long getRightHalf() {
        return UnsignedInt64.binToIntOffset(key, 8); 
    }
}

@@ -33,15 +33,38 @@
 h;%0A%0A
-/**%0A * 
+import java.security.Key;%0A%0A/**
 %0A * 
@@ -161,16 +161,31 @@
  SipKey 
+implements Key 
 %7B%0A    pr
@@ -208,20 +208,16 @@
 %5B%5D key;%0A
-    
 %0A    pub
@@ -384,28 +384,24 @@
  key;%0A    %7D%0A
-    
 %0A    long ge
@@ -417,24 +417,25 @@
 () %7B%0A       
+ 
 return Unsig
@@ -470,20 +470,15 @@
  0);
- 
 %0A    %7D%0A
-    
 %0A   
@@ -552,17 +552,329 @@
 key, 8);
- 
+%0A    %7D%0A%0A    @Override%0A    public String getAlgorithm() %7B%0A        return %22SipHash-2-4%22;%0A    %7D%0A%0A    @Override%0A    public String getFormat() %7B%0A        return null;  //To change body of implemented methods use File %7C Settings %7C File Templates.%0A    %7D%0A%0A    @Override%0A    public byte%5B%5D getEncoded() %7B%0A        return key;
 %0A    %7D%0A%7D

implement Key interface