#!/usr/local/bin/perl
#open files for writing outputs
open(INPUT_VECTORS, ">../vectors/golden_vectors") or die "Can't open file golden_vectors.";
open(OUTPUT_VECTORS, ">../vectors/golden_result_vectors") or die "Can't open file output_vectors.";

#generate 150 random values and multiply them then output the results in binary
for($i=0; $i<150; $i++){
	$a = int(rand(65537));
	$b = int(rand(65537));
	$ans = $a*$b;
	
	$a_bin = unpack('B16', pack('n', $a));
	$b_bin = unpack('B16', pack('n', $b));
	$ans_bin = unpack('B32', pack('N', $ans));
	
	print INPUT_VECTORS "$a_bin $b_bin $ans_bin\n";
	print OUTPUT_VECTORS "$ans_bin\n";
}

#close files used
close INPUT_VECTORS;
close OUTPUT_VECTORS;
