anchor.diff:  // foo=bar&baz=qux&zap=zazzle
   let decodeCookie (text:string) = 
       let parts = text.Split('&')
  -    parts |> Seq.map (fun x -> x.Split('=')) |> Seq.map (fun ps -> (ps.[0], ps.[1])) |> Map.ofSeq
  +    parts |> Seq.map (fun x -> x.Split('=')) |> Seq.map (fun ps -> (ps.[0], ps.[1])) |> Seq.toArray
   
  -let encodeCookie (map:Map<string,string>) : (string) =
  +let encodeCookie (map:List<string *string>) : (string) =
       map
  -    |> Seq.map (fun kvp ->
  -        let key = kvp.Key.Replace("&", "").Replace("=", "")
  -        let value = kvp.Value.Replace("&", "").Replace("=", "")
  +    |> Seq.map (fun (k, v) ->
  +        let key = k.Replace("&", "").Replace("=", "")
  +        let value = v.Replace("&", "").Replace("=", "")
           key + "=" + value)
       |> Seq.reduce (fun a b -> a + "&" + b)
   
  
positive.code: ﻿open System
  open System.IO
  open System.Security.Cryptography
  
  let toByte (char:char) : (byte) =
      byte(char)
  
negative.code:     let bytesToEncrypt = text |> toBytes |> Seq.toArray
      encryptAesEcb key iv bytesToEncrypt
  
  let decryptProfile (key:byte[]) (bytesToDecrypt:byte[]) : (string * string)[]  =
      let blockSize = 16
      let iv = Array.zeroCreate<byte> blockSize
      let decryptedBytes = decryptAesEcb key iv bytesToDecrypt
      printAt 16 decryptedBytes
      let decryptedText = decryptedBytes |> toText 
      let decryptedCookie = decodeCookie decryptedText
      decryptedCookie
      
  let random = new Random(271)
  let aesKey = randomAesKey random
  let profile = [("email","foo@bar.com"); ("uid","10"); ("role","user")]
  let encryptedProfile = encryptProfile aesKey profile
  
  let decryptedProfile = decryptProfile aesKey encryptedProfile
  
  let profileFor (email:string) : (string) =
      let profile = [("email",email); ("uid","10"); ("role","user")] // |> Map.ofSeq
      encodeCookie profile
  
  let getEncryptedProfile (email:string) : (byte[]) =
      let profile = profileFor email
      encryptProfile2 aesKey profile
  
  
  
      // ECB Cut-and-Paste
  let createAdminRole (getEncryptedProfile:string -> byte[]) =
  
      // 'email=foo@barba.'
      // 'com&uid=10&role='
      // 'user'
      let t0 = "foo@barba.com"
      let b0 = getEncryptedProfile t0
  
      printfn "'%s'" t0
      printAt 16 b0
      printfn "%d" b0.Length
  
      printfn ""
  
  
      
  
  
      // 'email=adminarba.'
      // 'admin           '
      // 'com&uid=10&role='
      // 'user'
  
      //let t1 = "foo@barba." + "admin           " + "com"
      let t1 = "foo@barba." + ("admin" + new String(char(12uy), 16 - 5)) + "com"
      let b1 = getEncryptedProfile t1
      printfn "'%s'" t1
      printAt 16 b1
      printfn "%d" b1.Length
      
  
      // email=adminarba.
      let firstBlock = Array.sub b0 0 16
      // com&uid=10&role=
      let secondBlock = Array.sub b0 16 16
      // admin
      let thirdBlock = Array.sub b1 16 16
  
      let hack = Array.concat [firstBlock; secondBlock; thirdBlock]
  
      printfn "%A"  (decryptProfile aesKey b0)
      printfn "%A"  (decryptProfile aesKey hack)
  
  let doit () =
      createAdminRole (getEncryptedProfile)