Files
Pascal Bleser a8c2beac3a test(groupware): add testcontainers based jmap test
* adds pkg/jmap/jmap_integration_test.go

 * uses ghcr.io/stalwartlabs/stalwart:v0.13.2-alpine

 * can be disabled by setting one of the following environment
   variables, in the same fashion as ca0493b28
   - CI=woodpecker
   - CI_SYSTEM_NAME=woodpecker
   - USE_TESTCONTAINERS=false

 * dependencies:
   - bump github.com/go-test/deep from 1.1.0 to 1.1.1
   - add github.com/cention-sany/utf7
   - add github.com/dustinkirkland/golang-petname
   - add github.com/emersion/go-imap/v2
   - add github.com/emersion/go-message
   - add github.com/emersion/go-sasl
   - add github.com/go-crypt/crypt
   - add github.com/go-crypt/x
   - add github.com/gogs/chardet
   - add github.com/inbucket/html2text
   - add github.com/jhilleryerd/enmime/v2
   - add github.com/ssor/bom
   - add gopkg.in/loremipsum.v1
2025-12-09 09:15:37 +01:00

55 lines
748 B
Go

package crypt
import (
b64 "github.com/go-crypt/x/base64"
)
func permute(sum, table []byte) []byte {
size := len(table)
key := make([]byte, size)
for i := 0; i < size; i++ {
key[i] = sum[table[i]]
}
return b64.EncodeCrypt(key)
}
func even(i int) bool {
return i%2 == 0
}
var (
cleanBytes = make([]byte, 64)
)
func clean(b []byte) {
l := len(b)
for ; l > 64; l -= 64 {
copy(b[l-64:l], cleanBytes)
}
if l > 0 {
copy(b[0:l], cleanBytes[0:l])
}
}
func repeat(input []byte, length int) []byte {
var (
seq = make([]byte, length)
unit = len(input)
)
j := length / unit * unit
for i := 0; i < j; i += unit {
copy(seq[i:length], input)
}
if j < length {
copy(seq[j:length], input[0:length-j])
}
return seq
}