{"ScriptPreparationCode":null,"TestCases":[{"Name":"hashlookup","Code":"const md5 = \u002711111111111111111111111111111111\u0027;\r\nconst sha1 = \u00271111111111111111111111111111111111111111\u0027;\r\nconst sha256 = \u00271111111111111111111111111111111111111111111111111111111111111111\u0027;\r\nconst invalid = \u002721345\u0027;\r\nconst size = 10000;\r\n\r\nconst hashLookup = ( () =\u003E {\r\n const hashes = {\r\n 32: \u0027md5\u0027,\r\n 64: \u0027sha256\u0027,\r\n 40: \u0027sha1\u0027\r\n };\r\n return function( hash ) { return hashes[ hash.length ]; };\r\n} )();\r\n\r\nfor ( let i = 0; i \u003C size; i\u002B\u002B ) {\r\n hashLookup(md5);\r\n hashLookup(sha1);\r\n hashLookup(sha256);\r\n hashLookup(invalid);\r\n}","IsDeferred":false},{"Name":"hashswitch","Code":"let md5 = \u002711111111111111111111111111111111\u0027;\r\nlet sha1 = \u00271111111111111111111111111111111111111111\u0027;\r\nlet sha256 = \u00271111111111111111111111111111111111111111111111111111111111111111\u0027;\r\nlet invalid = \u002721345\u0027;\r\nconst size = 10000;\r\n\r\nhashSwitch = function hashSwitch( hash ) {\r\n switch( hash.length ) {\r\n case 32: {\r\n return \u0027md5\u0027;\r\n }\r\n case 40: {\r\n return \u0027sha1\u0027;\r\n }\r\n case 64: {\r\n return \u0027sha256\u0027;\r\n }\r\n }\r\n}\r\n\r\nfor ( let i = 0; i \u003C size; i\u002B\u002B ) {\r\n hashSwitch(md5);\r\n hashSwitch(sha1);\r\n hashSwitch(sha256);\r\n hashSwitch(invalid);\r\n}","IsDeferred":false}]}