| 123456789101112131415161718192021222324252627282930313233343536373839 |
- import 'package:bbyyy/https/MyDio.dart';
- import 'package:bbyyy/my_tools/my_cookie.dart';
- import 'package:encrypt/encrypt.dart';
- class s {
- encryption() {
- // print('encryption=========================================');
- String timestamp = MyCookie().prefs.getString('timestamp');
- String uid = MyCookie().prefs.getString('uid');
- String s = timestamp.replaceRange(0, uid.length, uid);
- // print(timestamp);
- // print(uid);
- // print(s);
- // print(s.substring(0, 16));
- // print(s.substring(16, s.length));
- var sk = s.substring(0, 16);
- var sv = s.substring(16);
- // print(sk);
- // print(sv);
- final key = Key.fromUtf8(sk);
- final iv = IV.fromUtf8(sv);
- final encrypter = Encrypter(AES(key, mode: AESMode.cbc));
- // print('MyCookie().prefs.getString(using)==============${MyCookie().prefs.getString('using')}');
- String using = MyCookie().prefs.getString('using').split(',').last;
- var decrypt16 = encrypter.decrypt64(using, iv: iv);
- // print(decrypt16);
- MyCookie().server = decrypt16.split(':')[1];
- // if(MyCookie().server=='bby.banghuo.net'){
- // MyCookie().server = '172.162.104.19';
- // }
- // if(MyCookie().server=='localhost'){
- // MyCookie().server = '172.163.104.19';
- // }
- MyCookie().prefs.setString('serverID', decrypt16.split(':')[0]);
- MyDio().initDio();
- // print('encryption=========================================');
- }
- }
|