Created
October 8, 2024 06:38
-
-
Save demixdn/2a1472f2956fb0cc8b90acb65174a026 to your computer and use it in GitHub Desktop.
Pseudo passw generator. Use your set of symbols as 'source' param.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'dart:math'; | |
void main() { | |
print(generate('qwertyuiop1234567890')); | |
} | |
String generate(String source, [int rLength = 15]){ | |
final l = source.length; | |
final extra = '1234567890qwertyuiopasdfghjklzxcvbnm!#*()-=+<>?plmoknijbuhvygctfxrdzesawq0192837465'.split('').toList()..shuffle(); | |
final extraS = extra.take(5).join(); | |
final isUpperCase = Random().nextBool(); | |
final s = '$source${isUpperCase ? extraS.toUpperCase() : extraS}'; | |
final shuffled = s.split('').toList()..shuffle(); | |
return shuffled.take(min(rLength, l)).join(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment