mirror of
				https://github.com/esiur/esiur-dart.git
				synced 2025-10-30 23:31:36 +00:00 
			
		
		
		
	generateDC
This commit is contained in:
		| @@ -1,5 +1,7 @@ | ||||
| import 'dart:math'; | ||||
|  | ||||
| import '../Data/DC.dart'; | ||||
|  | ||||
| class Global { | ||||
|   static String generateCode( | ||||
|       [int length = 16, | ||||
| @@ -10,4 +12,11 @@ class Global { | ||||
|     return String.fromCharCodes(Iterable.generate( | ||||
|         length, (_) => chars.codeUnitAt(rand.nextInt(chars.length)))); | ||||
|   } | ||||
|  | ||||
|   static DC generateDC(int length) { | ||||
|     var rand = Random(); | ||||
|     var rt = DC(length); | ||||
|     for (var i = 0; i < length; i++) rt.setInt8(i, rand.nextInt(255)); | ||||
|     return rt; | ||||
|   } | ||||
| } | ||||
|   | ||||
| @@ -302,8 +302,7 @@ class DistributedConnection extends NetworkConnection implements IStore { | ||||
|       _session.remoteMethod = AuthenticationMethod.None; | ||||
|  | ||||
|       _session.localHeaders[IIPAuthPacketHeader.Domain] = domain; | ||||
|       _session.localHeaders[IIPAuthPacketHeader.Nonce] = | ||||
|           Global.generateCode(32); | ||||
|       _session.localHeaders[IIPAuthPacketHeader.Nonce] = Global.generateDC(32); | ||||
|  | ||||
|       if (method == AuthenticationMethod.Credentials) { | ||||
|         _session.localHeaders[IIPAuthPacketHeader.Username] = username; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user