// Copyright 2016 The Mellium Contributors.
// Use of this source code is governed by the BSD 2-clause
// license that can be found in the LICENSE file.

package sasl

import (
	
	
)

// Generates a nonce with n random bytes base64 encoded to ensure that it meets
// the criteria for inclusion in a SCRAM message.
func ( int,  io.Reader) []byte {
	if  < 1 {
		panic("Cannot generate zero or negative length nonce")
	}
	 := make([]byte, )
	,  := .Read()
	switch {
	case  != nil:
		panic()
	case  != :
		panic("Could not read enough randomness to generate nonce")
	}
	 := make([]byte, base64.RawStdEncoding.EncodedLen())
	base64.RawStdEncoding.Encode(, )

	return 
}