<commit_before>package org.abstractj.kalium.publickey;

import org.abstractj.kalium.NaCl;
import org.abstractj.kalium.Sodium;
import org.junit.Assert;
import org.junit.Test;

/**
 * Created by joshjdevl on 1/24/16.
 */
public class SignatureTest {
    @Test
    public void testCombinedSignature() {
        Sodium sodium= NaCl.sodium();
        int ret=0;

        long publickeylen=Sodium.crypto_box_publickeybytes();
        long privatekeylen=Sodium.crypto_box_secretkeybytes();
        byte[] public_key=new byte[(int)publickeylen];
        byte[] private_key=new byte[(int)privatekeylen];
        System.out.println("Generating keypair");
        Sodium.randombytes(public_key,(int)publickeylen);
        Sodium.randombytes(private_key,(int)privatekeylen);
        //ret=Sodium.crypto_sign_keypair(public_key,private_key);
        System.out.println(ret);
        System.out.println("Generated keypair");

        byte[] originalmessage="test".getBytes();
        System.out.println("Original message="+new String(originalmessage));
        long signaturelen=Sodium.crypto_sign_bytes();
        byte[] signed_message=new byte[(int)signaturelen+originalmessage.length];
        final int[] signed_message_len = new int[1];
        System.out.println("Signing message");
        ret=Sodium.crypto_sign(signed_message,signed_message_len,originalmessage,originalmessage.length,private_key);
        System.out.println(ret);
        System.out.println("byte length="+signed_message.length);
        System.out.println("signed message size="+signed_message_len[0]);
        Assert.assertEquals(signed_message.length,signed_message_len[0]);
        System.out.println("Signed message=");

        byte[] message=new byte[originalmessage.length];
        final int[] messageSize=new int[1];
        System.out.println("Verifying message");
        ret=Sodium.crypto_sign_open(message, messageSize, signed_message, signed_message_len[0], public_key);
        System.out.println(ret);
        System.out.println("Recovered message="+new String(message));
        //Assert.assertEquals(0,ret);
    }
}<commit_msg>allocate extra space?? seems to work<commit_after>package org.abstractj.kalium.publickey;

import org.abstractj.kalium.NaCl;
import org.abstractj.kalium.Sodium;
import org.junit.Assert;
import org.junit.Test;

/**
 * Created by joshjdevl on 1/24/16.
 */
public class SignatureTest {
    @Test
    public void testCombinedSignature() {
        Sodium sodium= NaCl.sodium();
        int ret=0;

        long publickeylen=Sodium.crypto_box_publickeybytes();
        long privatekeylen=Sodium.crypto_box_secretkeybytes();
        final byte[] public_key=new byte[(int)publickeylen+50];
        final byte[] private_key=new byte[(int)privatekeylen+50];
        System.out.println("Generating keypair");
        Sodium.randombytes(public_key,(int)publickeylen);
        Sodium.randombytes(private_key,(int)privatekeylen);
        ret=Sodium.crypto_sign_keypair(public_key,private_key);
        System.out.println(ret);
        System.out.println("Generated keypair");

        byte[] originalmessage="test".getBytes();
        System.out.println("Original message="+new String(originalmessage));
        long signaturelen=Sodium.crypto_sign_bytes();
        byte[] signed_message=new byte[(int)signaturelen+originalmessage.length];
        final int[] signed_message_len = new int[1];
        System.out.println("Signing message");
        ret=Sodium.crypto_sign(signed_message,signed_message_len,originalmessage,originalmessage.length,private_key);
        System.out.println(ret);
        System.out.println("byte length="+signed_message.length);
        System.out.println("signed message size="+signed_message_len[0]);
        Assert.assertEquals(signed_message.length,signed_message_len[0]);
        System.out.println("Signed message=");

        byte[] message=new byte[originalmessage.length];
        final int[] messageSize=new int[1];
        System.out.println("Verifying message");
        ret=Sodium.crypto_sign_open(message, messageSize, signed_message, signed_message_len[0], public_key);
        System.out.println(ret);
        System.out.println("Recovered message="+new String(message));
        Assert.assertEquals(0,ret);
    }
}
{'fraction_non_alphanumeric': 0.12461791676463672, 'fraction_numerical': 0.006583588055490242, 'mean_word_length': 3.9465116279069767, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3871582', 'n_tokens_mistral': 1278, 'n_tokens_neox': 1245, 'n_words': 189}