Created
August 9, 2022 04:00
-
-
Save mlieberman85/98415826f3f74643d6722fda7c7fac1f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// You can edit this code! | |
// Click here and start typing. | |
package main | |
import ( | |
"crypto/ecdsa" | |
"crypto/elliptic" | |
"fmt" | |
"math/big" | |
"reflect" | |
) | |
func getDSSEExampleKey() *ecdsa.PublicKey { | |
x := new(big.Int) | |
y := new(big.Int) | |
if _, ok := x.SetString("46950820868899156662930047687818585632848591499744589407958293238635476079160", 10); !ok { | |
return nil | |
} | |
if _, ok := y.SetString("5640078356564379163099075877009565129882514886557779369047442380624545832820", 10); !ok { | |
return nil | |
} | |
return &ecdsa.PublicKey{ | |
Curve: elliptic.P256(), | |
X: x, | |
Y: y, | |
} | |
} | |
func z() ecdsa.PublicKey { | |
x := new(big.Int) | |
y := new(big.Int) | |
x.SetString("46950820868899156662930047687818585632848591499744589407958293238635476079160", 10) | |
y.SetString("5640078356564379163099075877009565129882514886557779369047442380624545832820", 10) | |
return ecdsa.PublicKey{ | |
Curve: elliptic.P256(), | |
X: x, | |
Y: y, | |
} | |
} | |
func main() { | |
x := map[string]map[interface{}]struct{}{"id1": {"foo": struct{}{}}} | |
y := map[string]map[interface{}]struct{}{"id1": {"foo": struct{}{}}} | |
a := *getDSSEExampleKey() | |
b := *getDSSEExampleKey() | |
c := z() | |
d := z() | |
e := map[string]map[interface{}]struct{}{"id1": {z(): struct{}{}}} | |
f := map[string]map[interface{}]struct{}{"id1": {z(): struct{}{}}} | |
fmt.Printf("%v\n", reflect.DeepEqual(x, y)) | |
fmt.Printf("%v\n", a == b) | |
fmt.Printf("%v\n", c.Equal(c)) | |
fmt.Printf("%v\n", c.Equal(d)) | |
fmt.Printf("%v\n", c == c) | |
fmt.Printf("%v\n", c == d) | |
fmt.Printf("%v\n", reflect.DeepEqual(c, d)) | |
fmt.Printf("%v\n", reflect.DeepEqual(e, f)) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment