Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 2 of 2 for GenerateIV (0.05 sec)

  1. internal/crypto/key.go

    	mac := hmac.New(sha256.New, extKey)
    	mac.Write([]byte(Context))
    	mac.Write(nonce[:])
    	mac.Sum(key[:0])
    	return key
    }
    
    // GenerateIV generates a new random 256 bit IV from the provided source
    // of randomness. If random is nil the default PRNG of the system
    // (crypto/rand) is used.
    func GenerateIV(random io.Reader) (iv [32]byte) {
    	if random == nil {
    		random = rand.Reader
    	}
    	if _, err := io.ReadFull(random, iv[:]); err != nil {
    Registered: Sun Nov 03 19:28:11 UTC 2024
    - Last Modified: Tue Mar 19 20:28:10 UTC 2024
    - 6.4K bytes
    - Viewed (0)
  2. internal/crypto/key_test.go

    	defer func(l bool) { logger.DisableLog = l }(logger.DisableLog)
    	logger.DisableLog = true
    
    	for i, test := range generateIVTests {
    		i, test := i, test
    		func() {
    			defer recoverTest(i, test.ShouldPass, t)
    			iv := GenerateIV(test.Random)
    			if iv == [32]byte{} {
    				t.Errorf("Test %d: generated IV is zero IV", i) // check that we generate random and unique IV
    			}
    		}()
    	}
    }
    
    var sealUnsealKeyTests = []struct {
    Registered: Sun Nov 03 19:28:11 UTC 2024
    - Last Modified: Fri Jul 12 20:51:54 UTC 2024
    - 6.7K bytes
    - Viewed (0)
Back to top