utils.com.unbound.common.Bits Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of unbound-java-provider Show documentation
Show all versions of unbound-java-provider Show documentation
This is a collection of JAVA libraries that implement Unbound cryptographic classes for JAVA provider, PKCS11 wrapper, cryptoki, and advapi
package com.unbound.common;
public class Bits
{
public static int get(byte[] src, int bitIndex)
{
int offset = bitIndex >> 3;
bitIndex &= 7;
return (src[offset]>>bitIndex) & 1;
}
public static void set(byte[] dst, int bitIndex, int bit)
{
int offset = bitIndex >> 3;
bitIndex &= 7;
bit <<= bitIndex;
dst[offset] &= ~(1<