Exemple #1
0
        protected static void __hx_ctor_haxe_crypto_BaseCode(global::haxe.crypto.BaseCode __hx_this, global::haxe.io.Bytes @base)
        {
            unchecked {
                                #line 34 "C:\\HaxeToolkit\\haxe\\std\\haxe\\crypto\\BaseCode.hx"
                int len   = @base.length;
                int nbits = 1;
                                #line 36 "C:\\HaxeToolkit\\haxe\\std\\haxe\\crypto\\BaseCode.hx"
                while ((len > (1 << nbits)))
                {
                                        #line 37 "C:\\HaxeToolkit\\haxe\\std\\haxe\\crypto\\BaseCode.hx"
                    ++nbits;
                }

                                #line 38 "C:\\HaxeToolkit\\haxe\\std\\haxe\\crypto\\BaseCode.hx"
                if (((nbits > 8) || (len != (1 << nbits))))
                {
                                        #line 39 "C:\\HaxeToolkit\\haxe\\std\\haxe\\crypto\\BaseCode.hx"
                    throw global::haxe.lang.HaxeException.wrap("BaseCode : base length must be a power of two.");
                }

                                #line 40 "C:\\HaxeToolkit\\haxe\\std\\haxe\\crypto\\BaseCode.hx"
                __hx_this.@base = @base;
                __hx_this.nbits = nbits;
            }
                        #line default
        }
        protected static void __hx_ctor_haxe_crypto_BaseCode(global::haxe.crypto.BaseCode __hx_this, global::haxe.io.Bytes @base)
        {
            unchecked {
                                #line 34 "/opt/haxe/std/haxe/crypto/BaseCode.hx"
                int len   = @base.length;
                int nbits = 1;
                                #line 36 "/opt/haxe/std/haxe/crypto/BaseCode.hx"
                while ((len > (1 << nbits)))
                {
                                        #line 37 "/opt/haxe/std/haxe/crypto/BaseCode.hx"
                    ++nbits;
                }

                                #line 38 "/opt/haxe/std/haxe/crypto/BaseCode.hx"
                if (((nbits > 8) || (len != (1 << nbits))))
                {
                                        #line 39 "/opt/haxe/std/haxe/crypto/BaseCode.hx"
                    throw ((global::System.Exception)(global::haxe.Exception.thrown("BaseCode : base length must be a power of two.")));
                }

                                #line 40 "/opt/haxe/std/haxe/crypto/BaseCode.hx"
                __hx_this.@base = @base;
                __hx_this.nbits = nbits;
            }
                        #line default
        }
Exemple #3
0
        public static string encode(global::haxe.io.Bytes bytes, global::haxe.lang.Null <bool> complement)
        {
            unchecked {
                                #line 35 "/opt/haxe/std/haxe/crypto/Base64.hx"
                bool   complement1 = ((!(complement.hasValue)) ? (true) : ((complement).@value));
                string str         = new global::haxe.crypto.BaseCode(((global::haxe.io.Bytes)(global::haxe.crypto.Base64.BYTES))).encodeBytes(bytes).toString();
                                #line 37 "/opt/haxe/std/haxe/crypto/Base64.hx"
                if (complement1)
                {
                                        #line 38 "/opt/haxe/std/haxe/crypto/Base64.hx"
                    switch ((bytes.length % 3))
                    {
                    case 1:
                    {
                                                        #line 40 "/opt/haxe/std/haxe/crypto/Base64.hx"
                        str = global::haxe.lang.Runtime.concat(str, "==");
                                                        #line 40 "/opt/haxe/std/haxe/crypto/Base64.hx"
                        break;
                    }


                    case 2:
                    {
                                                        #line 42 "/opt/haxe/std/haxe/crypto/Base64.hx"
                        str = global::haxe.lang.Runtime.concat(str, "=");
                                                        #line 42 "/opt/haxe/std/haxe/crypto/Base64.hx"
                        break;
                    }


                    default:
                    {
                                                        #line 43 "/opt/haxe/std/haxe/crypto/Base64.hx"
                        break;
                    }
                    }
                }

                                #line 45 "/opt/haxe/std/haxe/crypto/Base64.hx"
                return(str);
            }
                        #line default
        }
Exemple #4
0
        public static string encode(global::haxe.io.Bytes bytes, object complement)
        {
            unchecked {
                                #line 35 "C:\\HaxeToolkit\\haxe\\std\\haxe\\crypto\\Base64.hx"
                bool   complement1 = (((complement == default(object))) ? (true) : (global::haxe.lang.Runtime.toBool(complement)));
                string str         = new global::haxe.crypto.BaseCode(((global::haxe.io.Bytes)(global::haxe.crypto.Base64.BYTES))).encodeBytes(bytes).toString();
                                #line 37 "C:\\HaxeToolkit\\haxe\\std\\haxe\\crypto\\Base64.hx"
                if (complement1)
                {
                                        #line 38 "C:\\HaxeToolkit\\haxe\\std\\haxe\\crypto\\Base64.hx"
                    switch ((bytes.length % 3))
                    {
                    case 1:
                    {
                                                        #line 40 "C:\\HaxeToolkit\\haxe\\std\\haxe\\crypto\\Base64.hx"
                        str = global::haxe.lang.Runtime.concat(str, "==");
                                                        #line 40 "C:\\HaxeToolkit\\haxe\\std\\haxe\\crypto\\Base64.hx"
                        break;
                    }


                    case 2:
                    {
                                                        #line 42 "C:\\HaxeToolkit\\haxe\\std\\haxe\\crypto\\Base64.hx"
                        str = global::haxe.lang.Runtime.concat(str, "=");
                                                        #line 42 "C:\\HaxeToolkit\\haxe\\std\\haxe\\crypto\\Base64.hx"
                        break;
                    }


                    default:
                    {
                                                        #line 43 "C:\\HaxeToolkit\\haxe\\std\\haxe\\crypto\\Base64.hx"
                        break;
                    }
                    }
                }

                                #line 45 "C:\\HaxeToolkit\\haxe\\std\\haxe\\crypto\\Base64.hx"
                return(str);
            }
                        #line default
        }
Exemple #5
0
 public static string decode(string s, string @base)
 {
                 #line 134 "C:\\HaxeToolkit\\haxe\\std\\haxe\\crypto\\BaseCode.hx"
     global::haxe.crypto.BaseCode b = new global::haxe.crypto.BaseCode(((global::haxe.io.Bytes)(global::haxe.io.Bytes.ofString(@base, null))));
     return(b.decodeString(s));
 }
 public static string decode(string s, string @base)
 {
                 #line 134 "/opt/haxe/std/haxe/crypto/BaseCode.hx"
     global::haxe.crypto.BaseCode b = new global::haxe.crypto.BaseCode(((global::haxe.io.Bytes)(global::haxe.io.Bytes.ofString(@base, null))));
     return(b.decodeString(s));
 }