anchor.diff:          
       let getRecordField (r: 'record) (field : Reflection.PropertyInfo) =
           Microsoft.FSharp.Reflection.FSharpValue.GetRecordField(r,field) |> unbox
  -        
  -
  -    // Cryptography
  -
  -    // E:\projects\fs-random-snippets>"%HOME%\Documents\Visual Studio 2012\Projects\Tutorial3\.nuget\nuget" PBKDF2.NET
  -    // Installing 'PBKDF2.NET 2.0.0'.
  -    // Successfully installed 'PBKDF2.NET 2.0.0'.
  -    // #r @"PBKDF2.NET.2.0.0\lib\net45\PBKDF2.NET.dll"
  -
  -    // https://github.com/crowleym/HKDF
  -    // #r @"HKDF\RFC5869.dll"
  -    // open RFC5869
  +       
  +    // Encoding schemes
  +
  +    let random = new Random()
  +    
  +    let base32Chars     = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"
  +    let base32'8'9Chars = "ABCDEFGHIJK8MN9PQRSTUVWXYZ234567"
  +    let base64Chars     = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890+/"
  +    let base64urlChars  = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890-_"
  +
  +    let doBase32'8'9 (s : string) = 
  +        s.ToUpper().ToCharArray() 
  +        |> Array.map (fun x -> match x with | 'L' -> '9' | 'O' -> '9' | _ -> x )
  +        |> fun cs -> new string(cs)
  +
  +    let undoBase32'8'9 (s : string) = 
  +        s.ToUpper().ToCharArray() 
  +        |> Array.map (fun x -> match x with | '8' -> 'L' | '9' -> 'O' | _ -> x )
  +        |> fun cs -> new string(cs)
  +    
  +    let generateWeaveGUID() = 
  +        [| for i in [0 .. 11] do yield base64urlChars.Substring(random.Next(63), 1) |]
  +        |> Array.fold (fun r s -> r + s) ""
  +        |> (WeaveGUID)
  +
   
       // https://bitbucket.org/devinmartin/base32/src/90d7d530beea52a2a82b187728a06404794600b9/Base32/Base32Encoder.cs?at=default
       let base32Decode (s' : string) = 
  -        let undo89 (s : string) = 
  -            s.ToUpper().ToCharArray() 
  -            |> Array.map (fun x -> match x with | '8' -> 'L' | '9' -> 'O' | _ -> x )
  -        let s = s' |>  undo89 |> Array.filter (fun x -> if x = '=' then false else true) |> fun cs -> new string(cs)
  -        let encodingChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"
  +        let s = 
  +            s'.ToUpper().ToCharArray() 
  +            |> Array.filter (fun x -> if x = '=' then false else true) 
  +            |> fun cs -> new string(cs)        
           let encodedBitCount = 5
           let byteBitCount = 8
  -        if isSubset encodingChars s then       
  +        if isSubset base32Chars s then       
               let outputBuffer = Array.create (s.Length * encodedBitCount / byteBitCount) 0uy
               let mutable workingByte = 0uy
               let mutable bitsRemaining = byteBitCount
               let mutable mask = 0
               let mutable arrayIndex = 0
               for c in s.ToCharArray() do 
  -                let value = encodingChars.IndexOf c
  +                let value = base32Chars.IndexOf c
                   if bitsRemaining > encodedBitCount then
                       mask <- value <<< (bitsRemaining - encodedBitCount)
                       workingByte <- (workingByte ||| (byte) mask)
  
positive.code: 
      // Firefox Sync Secrets
  
      type Secret = { email                : string;
                      username             : string;
                      password             : string;
                      encryptionpassphrase : string }
  
  
      // CryptoKeys
  
      type SyncKeyBundle = { encryption_key : byte[]; 
                             hmac_key       : byte[] }
  
      type EncryptedCollection = { iv         : string
                                   ciphertext : string
                                   hmac       : string }
  
      type CryptoKeys = { ``default`` : byte [] [] }
  
  
  
  // Firefox Sync Secrets
  module Secrets = 
  
negative.code: [<AutoOpen>]
  module DataSignatures =
   
      // Firefox Object Formats
  
      // http://docs.services.mozilla.com/sync/objectformats.html
  
      type URI = URI of string
      
      // Firefox docs refer to GUID, but not according to RFC4122 
      // https://docs.services.mozilla.com/sync/storageformat5.html#metaglobal-record
      // "The Firefox client uses 12 randomly generated base64url characters, much like for WBO IDs."
      type WeaveGUID = WeaveGUID of string 
  
      type Addons = 
          { addonID       : string
            applicationID : string
            enabled       : Boolean
            source        : string }
  
      type Bookmarks = 
          { id            : WeaveGUID
            ``type``      : string
            title         : string
            parentName    : string
            bmkUri        : URI
            tags          : string []
            keyword       : string
            description   : string
            loadInSidebar : Boolean
            parentid      : WeaveGUID
            children      : WeaveGUID [] }
  
      type Microsummary = 
          { generatorUri  : string
            staticTitle   : string
            title         : string
            bmkUri        : string
            description   : string
            loadInSidebar : Boolean
            tags          : string []
            keyword       : string
            parentid      : string
            parentName    : string
            predecessorid : string
            ``type``      : string }
  
      type Query = 
          { folderName    : string
            queryId       : string
            title         : string
            bmkUri        : string
            description   : string
            loadInSidebar : Boolean
            tags          : string []
            keyword       : string
            parentid      : string
            parentName    : string
            predecessorid : string
            ``type``      : string }
  
      type Folder = 
          { title         : string
            parentid      : string
            parentName    : string
            predecessorid : string
            ``type``      : string }
  
      type Livemark = 
          { siteUri       : string
            feedUri       : string
            title         : string
            parentid      : string
            parentName    : string
            predecessorid : string
            ``type``      : string }
  
      type Separator = 
          { pos           : string
            parentid      : string
            parentName    : string
            predecessorid : string
            ``type``      : string 
            children      : string [] }
  
      type Clients = 
          { name      : string
            ``type``  : string
            commands  : string []
            version   : string
            protocols : string [] }
  
      type ClientsPayload = 
          { name         : string
            formfactor   : string
            application  : string
            version      : string
            capabilities : string
            mpEnabled    : Boolean }
  
      type Commands = 
          { receiverID : string
            senderID   : string
            created    : Int64
            action     : string
            data       : string }
  
      type Forms =  
          { name  :  string
            value : string }
  
      type HistoryTransition = 
      | TRANSITION_LINK  = 1
  