[precis] PRECIS Go implementation
Sam Whited <sam@samwhited.com> Fri, 05 February 2016 16:40 UTC
Return-Path: <sam@samwhited.com>
X-Original-To: precis@ietfa.amsl.com
Delivered-To: precis@ietfa.amsl.com
Received: from localhost (ietfa.amsl.com [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id E12451B3B30 for <precis@ietfa.amsl.com>; Fri, 5 Feb 2016 08:40:56 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: 0.52
X-Spam-Level:
X-Spam-Status: No, score=0.52 tagged_above=-999 required=5 tests=[BAYES_40=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FM_FORGED_GMAIL=0.622, SPF_PASS=-0.001] autolearn=no
Received: from mail.ietf.org ([4.31.198.44]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id JulBpK159Wuf for <precis@ietfa.amsl.com>; Fri, 5 Feb 2016 08:40:55 -0800 (PST)
Received: from mail-qg0-x22f.google.com (mail-qg0-x22f.google.com [IPv6:2607:f8b0:400d:c04::22f]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id B24BB1B3B2C for <precis@ietf.org>; Fri, 5 Feb 2016 08:40:55 -0800 (PST)
Received: by mail-qg0-x22f.google.com with SMTP id o11so71516054qge.2 for <precis@ietf.org>; Fri, 05 Feb 2016 08:40:55 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samwhited.com; s=swgoo; h=mime-version:from:date:message-id:subject:to:cc:content-type; bh=dVHY7mRdZFL8e97m16uoDYuzHJOVWlxgDtunr0VNe4c=; b=RyAn0xJJ9wo5o+zQv6t9zzOuIEntYIwtSnbkOj7HEoLE5bKigzWE8XezhLwJWMD4u6 vGlfupzgQoZPr1Jh6iwcx0NCC4nZy2RDM1ZaZvVKmfwlsZE/becehVE7adBHFw4COJA8 TNprWin7Acn61Fq3I2Fx5BO51jhI6xPXEZrNc=
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:from:date:message-id:subject:to:cc :content-type; bh=dVHY7mRdZFL8e97m16uoDYuzHJOVWlxgDtunr0VNe4c=; b=Pb2Rl63X/K9IJxaPNjNak7uglE8E17rhmHdQ68ycTwfr5dJp2APSxmu3eQ/GK0q+Bd vUWFdoVPKGQkutMctEqylT6amgjXvMe3lSGEK2It8UtgIGtLruPzCrSDmYot7z4MsmoC LtusuJfwCPxST3QOaUCfjj/IEsqqHBJuMjvdI1nszgi/gjSvN/wPHuCyqEJ+Gac7WRQu +nysIzCpDzEsFvdWbW+Ort/hPNPCFHY/JychYOTT0sbjpuq+/ieiIxnx3/dCevZhBCDL kq1VDgvViV73YBMkS4bxW7iQHN+3uIDPJkR2LDYjq7S7AYwqYW9K5oUMe/1/DG1GrSkS ks1w==
X-Gm-Message-State: AG10YORk8oh3jE1NBB6e8p545TW7EMI/Heo909ltihP8TYYBcsV1bNwnXs9ikgU7Jbprdk5aC61GazEXROLEFw==
X-Received: by 10.140.92.111 with SMTP id a102mr17596627qge.92.1454690454827; Fri, 05 Feb 2016 08:40:54 -0800 (PST)
MIME-Version: 1.0
Received: by 10.55.79.82 with HTTP; Fri, 5 Feb 2016 08:40:15 -0800 (PST)
X-Originating-IP: [72.48.156.244]
From: Sam Whited <sam@samwhited.com>
Date: Fri, 05 Feb 2016 10:40:15 -0600
Message-ID: <CAHbk4RKGsEXk6VCeyqL+OBx-1aocfoqUHr45qQ+93G3Jenrc4A@mail.gmail.com>
To: precis@ietf.org
Content-Type: text/plain; charset="UTF-8"
Archived-At: <http://mailarchive.ietf.org/arch/msg/precis/QS_PkuU98h6CgGiIvyB3JYgjYAU>
Cc: Peter Saint-Andre <peter@andyet.net>
Subject: [precis] PRECIS Go implementation
X-BeenThere: precis@ietf.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: Preparation and Comparison of Internationalized Strings <precis.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/precis>, <mailto:precis-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/precis/>
List-Post: <mailto:precis@ietf.org>
List-Help: <mailto:precis-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/precis>, <mailto:precis-request@ietf.org?subject=subscribe>
X-List-Received-Date: Fri, 05 Feb 2016 16:40:57 -0000
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] PRECIS Go implementation Sam Whited