Sha256: 5332632f02b5678e9ab26ae5d2a3d5f3eb705d77600ad91588b490578d1dcd55

Contents?: true

Size: 453 Bytes

Versions: 16

Compression:

Stored size: 453 Bytes

Contents

// package padding provides various padding algorithms
package padding

import (
	"bytes"
)

// Align left pads given byte array with zeros till it have at least bitSize length. 
func Align(data []byte, bitSize int) []byte {
	
	actual:=len(data)	
	required:=bitSize >> 3
	
	if (bitSize % 8) > 0 {
		required++  //extra byte if needed
	}
	
	if (actual >= required) {
		return data
	} 
	
	return append(bytes.Repeat([]byte{0}, required-actual), data...)
}

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
ruby_snowflake_client-1.3.7 ext/vendor/github.com/dvsekhvalnov/jose2go/padding/align.go
ruby_snowflake_client-1.3.6 ext/vendor/github.com/dvsekhvalnov/jose2go/padding/align.go
ruby_snowflake_client-1.3.5 ext/vendor/github.com/dvsekhvalnov/jose2go/padding/align.go
ruby_snowflake_client-1.3.4 ext/vendor/github.com/dvsekhvalnov/jose2go/padding/align.go
ruby_snowflake_client-1.3.4.pre.debug ext/vendor/github.com/dvsekhvalnov/jose2go/padding/align.go
ruby_snowflake_client-1.3.3.pre.debug ext/vendor/github.com/dvsekhvalnov/jose2go/padding/align.go
ruby_snowflake_client-1.3.2 ext/vendor/github.com/dvsekhvalnov/jose2go/padding/align.go
ruby_snowflake_client-1.3.1 ext/vendor/github.com/dvsekhvalnov/jose2go/padding/align.go
ruby_snowflake_client-1.3.0 ext/vendor/github.com/dvsekhvalnov/jose2go/padding/align.go
ruby_snowflake_client-1.2.1 ext/vendor/github.com/dvsekhvalnov/jose2go/padding/align.go
ruby_snowflake_client-1.2.0 ext/vendor/github.com/dvsekhvalnov/jose2go/padding/align.go
ruby_snowflake_client-1.1.1 ext/vendor/github.com/dvsekhvalnov/jose2go/padding/align.go
ruby_snowflake_client-1.1.0 ext/vendor/github.com/dvsekhvalnov/jose2go/padding/align.go
ruby_snowflake_client-1.0.2 ext/vendor/github.com/dvsekhvalnov/jose2go/padding/align.go
ruby_snowflake_client-1.0.1 ext/vendor/github.com/dvsekhvalnov/jose2go/padding/align.go
ruby_snowflake_client-1.0.0 ext/vendor/github.com/dvsekhvalnov/jose2go/padding/align.go