package meerkat.crypto.utils;

import java.math.BigInteger;

/**
 * Created by Tzlil on 4/7/2016.
 */
public class BigIntegerByteEncoder implements org.factcenter.qilin.util.ByteEncoder<BigInteger> {
    @Override
    public byte[] encode(BigInteger input) {
        return input.toByteArray();
    }

    @Override
    public BigInteger decode(byte[] input) {
        return new BigInteger(1,input);
    }

    @Override
    public int getMinLength() {
        return 0;
    }

    @Override
    public BigInteger denseDecode(byte[] input) {
        return decode(input);
    }
}
