Hi all, I've mentioned that I was working on a Golang implementation of PRECIS on this list before, and now that it's been merged into the experimental part of the Go standard library I wanted to provide an update and announce it's availability:
https://godoc.org/golang.org/x/text/secure/precis There are still a few hiccups and TODO's, mostly due to the fact that there's not currently a Go implementation of the BIDI rule, but those should be smoothed out over time and I'm convinced that it's mostly compatible with other PRECIS implementations like Christian Schedt's recent Java version (from which I stole many tests, thanks Christian). The source can be found here, for anyone who is interested: https://github.com/golang/text/tree/master/secure/precis An interesting thing to note about this implementation is that we decided that it is fast enough to NOT implement the prepare step. Instead, clients and servers alike are expected perform enforcement. To give a quick example, here is a benchmark of enforcing the string "Malvolio" (including setup and teardown, not reusing constructed profiles): PASS BenchmarkUsernameCaseMapped-8 300000 5727 ns/op 14064 B/op 20 allocs/op BenchmarkUsernameCasePreserved-8 300000 5428 ns/op 14064 B/op 20 allocs/op BenchmarkOpaqueString-8 300000 4736 ns/op 9888 B/op 19 allocs/op BenchmarkNickname-8 300000 4874 ns/op 9888 B/op 19 allocs/op ok _/home/sam/src/golang-x-text/secure/precis 6.452s While this doesn't look great at first glance, it's worth noting that this is a naive implementation with minimal optimizations beyond pre-generating a trie of derived properties. It will be quite easy to go back and get those 20 allocations per operation down to a more reasonable number (even after adding BIDI support), which should increase the speed per operation significantly. Best, Sam -- Sam Whited pub 4096R/54083AE104EA7AD3 https://blog.samwhited.com _______________________________________________ precis mailing list [email protected] https://www.ietf.org/mailman/listinfo/precis
