code: func nonceRFC6979(privkey *big.Int, hash []byte) *big.Int {
  
  	curve := S256()
  	q := curve.Params().N
  	x := privkey
  	alg := sha256.New
  
  	qlen := q.BitLen()
  	holen := alg().Size()
  	rolen := (qlen + 7) >> 3
  	bx := append(int2octets(x, rolen), bits2octets(hash, curve, rolen)...)
  
  	// Step B
  	v := bytes.Repeat(oneInitializer, holen)
  
  	// Step C (Go zeroes the all allocated memory)
  	k := make([]byte, holen)
  
  	// Step D
  	k = mac(alg, k, append(append(v, 0x00), bx...))
  
  	// Step E
  	v = mac(alg, k, v)
  
  	// Step F
  	k = mac(alg, k, append(append(v, 0x01), bx...))
  
  	// Step G
  	v = mac(alg, k, v)
  
  	// Step H
  	for {
  		// Step H1
  		var t []byte
  
  		// Step H2
  		for len(t)*8 < qlen {
  			v = mac(alg, k, v)
  			t = append(t, v...)
  		}
  
  		// Step H3
  		secret := hashToInt(t, curve)
  		if secret.Cmp(one) >= 0 && secret.Cmp(q) < 0 {
  			return secret
  		}
  		k = mac(alg, k, append(v, 0x00))
  		v = mac(alg, k, v)
  	}
  }
docs: // nonceRFC6979 generates an ECDSA nonce (`k`) deterministically according to RFC 6979.
  // It takes a 32-byte hash as an input and returns 32-byte nonce to be used in ECDSA algorithm.