


1. base64 encryption
Introduce the base64.js file into the page, and the calling method is:
<!DOCTYPE HTML> <html> <head> <meta charset="utf-8"> <title>base64加密</title> <script type="text/javascript" src="base64.js"></script> <script type="text/javascript"> var b = new Base64(); var str = b.encode("admin:admin"); alert("base64 encode:" + str); //解密 str = b.decode(str); alert("base64 decode:" + str); </script> </head> <body> </body> </html>
2. md5 encryption
To reference the md5.js file in the page, the calling method is
<!DOCTYPE HTML> <html> <head> <meta charset="utf-8"> <title>md5加密</title> <script type="text/ecmascript" src="md5.js"></script> <script type="text/javascript"> var hash = hex_md5("123dafd"); alert(hash) </script> </head> <body> </body> </html>
3. sha1 encryption
It is said that this is the most secure encryption
Introducing sha1.js into the page, the calling method is
<!DOCTYPE HTML> <html> <head> <meta charset="utf-8"> <title>sha1加密</title> <script type="text/ecmascript" src="sha1.js"></script> <script type="text/javascript"> var sha = hex_sha1('mima123465') alert(sha) </script> </head> <body> </body> </html>
Very popular javascript md5 encryption
The MD5 encryption of javascript I saw on the Internet is relatively good, so I excerpted it for reference
<HTML> <HEAD> <META http-equiv='Content-Type' content='text/html; charset=gb'> <TITLE>非常流行的JS的md加密办法</TITLE> </HEAD> <BODY > <input id=test value=webasp> <input type=button value=md onclick="alert(hex_md(test.value))"> <script> var hexcase = ; /* hex output format. - lowercase; - uppercase */ var bpad = ""; /* base- pad character. "=" for strict RFC compliance */ var chrsz = ; /* bits per input character. - ASCII; - Unicode */ /* * These are the functions you'll usually want to call * They take string arguments and return either hex or base- encoded strings */ function hex_md(s){ return binlhex(core_md(strbinl(s), s.length * chrsz));} function b_md(s){ return binlb(core_md(strbinl(s), s.length * chrsz));} function hex_hmac_md(key, data) { return binlhex(core_hmac_md(key, data)); } function b_hmac_md(key, data) { return binlb(core_hmac_md(key, data)); } /* Backwards compatibility - same as hex_md() */ function calcMD(s){ return binlhex(core_md(strbinl(s), s.length * chrsz));} /* * Perform a simple self-test to see if the VM is working */ function md_vm_test() { return hex_md("abc") == "cdfbdfdef"; } /* * Calculate the MD of an array of little-endian words, and a bit length */ function core_md(x, len) { /* append padding */ x[len >> ] |= x << ((len) % ); x[(((len + ) >>> ) << ) + ] = len; var a = ; var b = -; var c = -; var d = ; for(var i = ; i < x.length; i += ) { var olda = a; var oldb = b; var oldc = c; var oldd = d; a = md_ff(a, b, c, d, x[i+ ], , -); d = md_ff(d, a, b, c, x[i+ ], , -); c = md_ff(c, d, a, b, x[i+ ], , ); b = md_ff(b, c, d, a, x[i+ ], , -); a = md_ff(a, b, c, d, x[i+ ], , -); d = md_ff(d, a, b, c, x[i+ ], , ); c = md_ff(c, d, a, b, x[i+ ], , -); b = md_ff(b, c, d, a, x[i+ ], , -); a = md_ff(a, b, c, d, x[i+ ], , ); d = md_ff(d, a, b, c, x[i+ ], , -); c = md_ff(c, d, a, b, x[i+], , -); b = md_ff(b, c, d, a, x[i+], , -); a = md_ff(a, b, c, d, x[i+], , ); d = md_ff(d, a, b, c, x[i+], , -); c = md_ff(c, d, a, b, x[i+], , -); b = md_ff(b, c, d, a, x[i+], , ); a = md_gg(a, b, c, d, x[i+ ], , -); d = md_gg(d, a, b, c, x[i+ ], , -); c = md_gg(c, d, a, b, x[i+], , ); b = md_gg(b, c, d, a, x[i+ ], , -); a = md_gg(a, b, c, d, x[i+ ], , -); d = md_gg(d, a, b, c, x[i+], , ); c = md_gg(c, d, a, b, x[i+], , -); b = md_gg(b, c, d, a, x[i+ ], , -); a = md_gg(a, b, c, d, x[i+ ], , ); d = md_gg(d, a, b, c, x[i+], , -); c = md_gg(c, d, a, b, x[i+ ], , -); b = md_gg(b, c, d, a, x[i+ ], , ); a = md_gg(a, b, c, d, x[i+], , -); d = md_gg(d, a, b, c, x[i+ ], , -); c = md_gg(c, d, a, b, x[i+ ], , ); b = md_gg(b, c, d, a, x[i+], , -); a = md_hh(a, b, c, d, x[i+ ], , -); d = md_hh(d, a, b, c, x[i+ ], , -); c = md_hh(c, d, a, b, x[i+], , ); b = md_hh(b, c, d, a, x[i+], , -); a = md_hh(a, b, c, d, x[i+ ], , -); d = md_hh(d, a, b, c, x[i+ ], , ); c = md_hh(c, d, a, b, x[i+ ], , -); b = md_hh(b, c, d, a, x[i+], , -); a = md_hh(a, b, c, d, x[i+], , ); d = md_hh(d, a, b, c, x[i+ ], , -); c = md_hh(c, d, a, b, x[i+ ], , -); b = md_hh(b, c, d, a, x[i+ ], , ); a = md_hh(a, b, c, d, x[i+ ], , -); d = md_hh(d, a, b, c, x[i+], , -); c = md_hh(c, d, a, b, x[i+], , ); b = md_hh(b, c, d, a, x[i+ ], , -); a = md_ii(a, b, c, d, x[i+ ], , -); d = md_ii(d, a, b, c, x[i+ ], , ); c = md_ii(c, d, a, b, x[i+], , -); b = md_ii(b, c, d, a, x[i+ ], , -); a = md_ii(a, b, c, d, x[i+], , ); d = md_ii(d, a, b, c, x[i+ ], , -); c = md_ii(c, d, a, b, x[i+], , -); b = md_ii(b, c, d, a, x[i+ ], , -); a = md_ii(a, b, c, d, x[i+ ], , ); d = md_ii(d, a, b, c, x[i+], , -); c = md_ii(c, d, a, b, x[i+ ], , -); b = md_ii(b, c, d, a, x[i+], , ); a = md_ii(a, b, c, d, x[i+ ], , -); d = md_ii(d, a, b, c, x[i+], , -); c = md_ii(c, d, a, b, x[i+ ], , ); b = md_ii(b, c, d, a, x[i+ ], , -); a = safe_add(a, olda); b = safe_add(b, oldb); c = safe_add(c, oldc); d = safe_add(d, oldd); } return Array(a, b, c, d); } /* * These functions implement the four basic operations the algorithm uses. */ function md_cmn(q, a, b, x, s, t) { return safe_add(bit_rol(safe_add(safe_add(a, q), safe_add(x, t)), s),b); } function md_ff(a, b, c, d, x, s, t) { return md_cmn((b & c) | ((~b) & d), a, b, x, s, t); } function md_gg(a, b, c, d, x, s, t) { return md_cmn((b & d) | (c & (~d)), a, b, x, s, t); } function md_hh(a, b, c, d, x, s, t) { return md_cmn(b ^ c ^ d, a, b, x, s, t); } function md_ii(a, b, c, d, x, s, t) { return md_cmn(c ^ (b | (~d)), a, b, x, s, t); } /* * Calculate the HMAC-MD, of a key and some data */ function core_hmac_md(key, data) { var bkey = strbinl(key); if(bkey.length > ) bkey = core_md(bkey, key.length * chrsz); var ipad = Array(), opad = Array(); for(var i = ; i < ; i++) { ipad[i] = bkey[i] ^ x; opad[i] = bkey[i] ^ xCCCC; } var hash = core_md(ipad.concat(strbinl(data)), + data.length * chrsz); return core_md(opad.concat(hash), + ); } /* * Add integers, wrapping at ^. This uses -bit operations internally * to work around bugs in some JS interpreters. */ function safe_add(x, y) { var lsw = (x & xFFFF) + (y & xFFFF); var msw = (x >> ) + (y >> ) + (lsw >> ); return (msw << ) | (lsw & xFFFF); } /* * Bitwise rotate a -bit number to the left. */ function bit_rol(num, cnt) { return (num << cnt) | (num >>> ( - cnt)); } /* * Convert a string to an array of little-endian words * If chrsz is ASCII, characters > have their hi-byte silently ignored. */ function strbinl(str) { var bin = Array(); var mask = ( << chrsz) - ; for(var i = ; i < str.length * chrsz; i += chrsz) bin[i>>] |= (str.charCodeAt(i / chrsz) & mask) << (i%); return bin; } /* * Convert an array of little-endian words to a hex string. */ function binlhex(binarray) { var hex_tab = hexcase ? "ABCDEF" : "abcdef"; var str = ""; for(var i = ; i < binarray.length * ; i++) { str += hex_tab.charAt((binarray[i>>] >> ((i%)*+)) & xF) + hex_tab.charAt((binarray[i>>] >> ((i%)* )) & xF); } return str; } /* * Convert an array of little-endian words to a base- string */ function binlb(binarray) { var tab = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz+/"; var str = ""; for(var i = ; i < binarray.length * ; i += ) { var triplet = (((binarray[i >> ] >> * ( i %)) & xFF) << ) | (((binarray[i+ >> ] >> * ((i+)%)) & xFF) << ) | ((binarray[i+ >> ] >> * ((i+)%)) & xFF); for(var j = ; j < ; j++) { if(i * + j * > binarray.length * ) str += bpad; else str += tab.charAt((triplet >> *(-j)) & xF); } } return str; } </script> </BODY></HTML>

The main difference between Python and JavaScript is the type system and application scenarios. 1. Python uses dynamic types, suitable for scientific computing and data analysis. 2. JavaScript adopts weak types and is widely used in front-end and full-stack development. The two have their own advantages in asynchronous programming and performance optimization, and should be decided according to project requirements when choosing.

Whether to choose Python or JavaScript depends on the project type: 1) Choose Python for data science and automation tasks; 2) Choose JavaScript for front-end and full-stack development. Python is favored for its powerful library in data processing and automation, while JavaScript is indispensable for its advantages in web interaction and full-stack development.

Python and JavaScript each have their own advantages, and the choice depends on project needs and personal preferences. 1. Python is easy to learn, with concise syntax, suitable for data science and back-end development, but has a slow execution speed. 2. JavaScript is everywhere in front-end development and has strong asynchronous programming capabilities. Node.js makes it suitable for full-stack development, but the syntax may be complex and error-prone.

JavaScriptisnotbuiltonCorC ;it'saninterpretedlanguagethatrunsonenginesoftenwritteninC .1)JavaScriptwasdesignedasalightweight,interpretedlanguageforwebbrowsers.2)EnginesevolvedfromsimpleinterpreterstoJITcompilers,typicallyinC ,improvingperformance.

JavaScript can be used for front-end and back-end development. The front-end enhances the user experience through DOM operations, and the back-end handles server tasks through Node.js. 1. Front-end example: Change the content of the web page text. 2. Backend example: Create a Node.js server.

Choosing Python or JavaScript should be based on career development, learning curve and ecosystem: 1) Career development: Python is suitable for data science and back-end development, while JavaScript is suitable for front-end and full-stack development. 2) Learning curve: Python syntax is concise and suitable for beginners; JavaScript syntax is flexible. 3) Ecosystem: Python has rich scientific computing libraries, and JavaScript has a powerful front-end framework.

The power of the JavaScript framework lies in simplifying development, improving user experience and application performance. When choosing a framework, consider: 1. Project size and complexity, 2. Team experience, 3. Ecosystem and community support.

Introduction I know you may find it strange, what exactly does JavaScript, C and browser have to do? They seem to be unrelated, but in fact, they play a very important role in modern web development. Today we will discuss the close connection between these three. Through this article, you will learn how JavaScript runs in the browser, the role of C in the browser engine, and how they work together to drive rendering and interaction of web pages. We all know the relationship between JavaScript and browser. JavaScript is the core language of front-end development. It runs directly in the browser, making web pages vivid and interesting. Have you ever wondered why JavaScr


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Safe Exam Browser
Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

Dreamweaver Mac version
Visual web development tools

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment

SublimeText3 Mac version
God-level code editing software (SublimeText3)
