-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtest.js
More file actions
31 lines (24 loc) · 701 Bytes
/
Copy pathtest.js
File metadata and controls
31 lines (24 loc) · 701 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
const { exec } = require('child_process')
const mysql = require('mysql');
const crypto = require('crypto');
const connection = mysql.createConnection({
host: 'localhost',
port: 13306,
user: 'root',
password: 'root',
database: 'rtt_db'
});
connection.connect();
connection.query('SELECT "Hello World!" AS text', (error, results, fields) => {
if (error) throw error;
console.log(results[0].text);
});
connection.end();
function md5hex(str) {
const md5 = crypto.createHash('md5');
let temp = md5.update(str, 'binary').digest('hex');
temp = String(parseInt(temp.replace(/[^0-9]/g, '').slice(-8)));
return temp;
}
let data = md5hex('6e809cbda0732ac4845916a59016f954');
console.log(data);