Project

General

Profile

Keep locator format » History » Version 3

Tom Clegg, 10/02/2018 03:04 PM

1 1 Tom Clegg
h1. Keep locator format
2
3
Draft. See discussion at #2755
4
5
<pre>
6
locator       ::= sized-digest hint*
7
8
sized-digest  ::= digest size-hint
9
10
digest        ::= <32 lowercase hexadecimal digits>
11
12
size-hint     ::= "+" [0-9]+
13
14
hint          ::= "+" hint-type hint-content
15
16
hint-type     ::= [A-Z]+
17
18
hint-content  ::= [A-Za-z0-9@_-]*
19
20
sign-hint      ::= "+A" <40 lowercase hexadecimal digits> "@" sign-timestamp
21
22
sign-timestamp ::= <8 lowercase hexadecimal digits>
23
</pre>
24 2 Tom Clegg
25
h2. Regular expressions
26
27
Is it a valid locator?
28
29
<pre>
30
/^([0-9a-f]{32})\+([0-9]+)(\+[A-Z][-A-Za-z0-9@_]*)*$/
31
</pre>
32
33
h2. Good examples
34 3 Tom Clegg
  
35
(note md5hex("foo") == "acbd18db4cc2f85cedef654fccc4a4d8")
36 1 Tom Clegg
37 3 Tom Clegg
|@acbd18db4cc2f85cedef654fccc4a4d8+3@|
38
|@acbd18db4cc2f85cedef654fccc4a4d8+3+Z@|
39
|@acbd18db4cc2f85cedef654fccc4a4d8+3+Z+Ada39a3ee5e6b4b0d3255bfef95601890afd80709@53bed294@|
40 1 Tom Clegg
41 2 Tom Clegg
h2. Bad examples
42
43
||Why|
44 3 Tom Clegg
|@acbd18db4cc2f85cedef654fccc4a4d8@|No size hint|
45
|@acbd18db4cc2f85cedef654fccc4a4d8+Z+3@|Other hint before size hint|
46
|@acbd18db4cc2f85cedef654fccc4a4d8+3+3@|Multiple size hints|
47
|@acbd18db4cc2f85cedef654fccc4a4d8+3+z@|Hint does not start with uppercase letter|
48
|@acbd18db4cc2f85cedef654fccc4a4d8+3+Zfoo*bar@|Hint contains invalid character @*@|