|
| 1 | +{ |
| 2 | + "cells": [ |
| 3 | + { |
| 4 | + "cell_type": "markdown", |
| 5 | + "metadata": {}, |
| 6 | + "source": [ |
| 7 | + "## Generating passwords of length 8 using random,numpy libraries" |
| 8 | + ] |
| 9 | + }, |
| 10 | + { |
| 11 | + "cell_type": "code", |
| 12 | + "execution_count": 217, |
| 13 | + "metadata": {}, |
| 14 | + "outputs": [ |
| 15 | + { |
| 16 | + "name": "stdout", |
| 17 | + "output_type": "stream", |
| 18 | + "text": [ |
| 19 | + "0.00013525299982575234\n" |
| 20 | + ] |
| 21 | + }, |
| 22 | + { |
| 23 | + "data": { |
| 24 | + "text/plain": [ |
| 25 | + "['EE2V2LD8',\n", |
| 26 | + " 'L<WXUO>H',\n", |
| 27 | + " '508E9@D=',\n", |
| 28 | + " ';=OHLJOH',\n", |
| 29 | + " 'G@XP7BKD',\n", |
| 30 | + " 'X0M973>U',\n", |
| 31 | + " 'INV5HFBF',\n", |
| 32 | + " '<IB7A9CD',\n", |
| 33 | + " 'M5YQCQ42',\n", |
| 34 | + " 'NTV@HI<A']" |
| 35 | + ] |
| 36 | + }, |
| 37 | + "execution_count": 217, |
| 38 | + "metadata": {}, |
| 39 | + "output_type": "execute_result" |
| 40 | + } |
| 41 | + ], |
| 42 | + "source": [ |
| 43 | + "import random \n", |
| 44 | + "import numpy as np\n", |
| 45 | + "import timeit\n", |
| 46 | + "s=timeit.default_timer()\n", |
| 47 | + "a=[]\n", |
| 48 | + "def genP(l):\n", |
| 49 | + " for _ in range(l):\n", |
| 50 | + " a.append(''.join(map(lambda p:chr(p),np.random.randint(48,90,8))))\n", |
| 51 | + " \n", |
| 52 | + " return a\n", |
| 53 | + "print(timeit.default_timer()-s)\n", |
| 54 | + "genP(10)" |
| 55 | + ] |
| 56 | + }, |
| 57 | + { |
| 58 | + "cell_type": "code", |
| 59 | + "execution_count": null, |
| 60 | + "metadata": {}, |
| 61 | + "outputs": [], |
| 62 | + "source": [] |
| 63 | + }, |
| 64 | + { |
| 65 | + "cell_type": "markdown", |
| 66 | + "metadata": {}, |
| 67 | + "source": [ |
| 68 | + "## Generating passwords of length 8 using random,string libraries" |
| 69 | + ] |
| 70 | + }, |
| 71 | + { |
| 72 | + "cell_type": "code", |
| 73 | + "execution_count": 219, |
| 74 | + "metadata": {}, |
| 75 | + "outputs": [ |
| 76 | + { |
| 77 | + "name": "stdout", |
| 78 | + "output_type": "stream", |
| 79 | + "text": [ |
| 80 | + "0.0002615470002638176\n" |
| 81 | + ] |
| 82 | + }, |
| 83 | + { |
| 84 | + "data": { |
| 85 | + "text/plain": [ |
| 86 | + "['Mk8MMvQP',\n", |
| 87 | + " 'Uqlg2uo7',\n", |
| 88 | + " '7L7wumtT',\n", |
| 89 | + " 'GUjvURkD',\n", |
| 90 | + " 'mABuJ2J4',\n", |
| 91 | + " 'eohQY2kP',\n", |
| 92 | + " 'qUd4cw18',\n", |
| 93 | + " '3iV7smW5',\n", |
| 94 | + " 'zBpB4Q6z',\n", |
| 95 | + " '6lbHNnN7']" |
| 96 | + ] |
| 97 | + }, |
| 98 | + "execution_count": 219, |
| 99 | + "metadata": {}, |
| 100 | + "output_type": "execute_result" |
| 101 | + } |
| 102 | + ], |
| 103 | + "source": [ |
| 104 | + "import random\n", |
| 105 | + "import string \n", |
| 106 | + "import timeit\n", |
| 107 | + "import numpy as np\n", |
| 108 | + "st=timeit.default_timer()\n", |
| 109 | + "a=[]\n", |
| 110 | + "s=string.ascii_letters+string.digits\n", |
| 111 | + "def genp(l):\n", |
| 112 | + " for _ in range(l):\n", |
| 113 | + " a.append(''.join(random.choice(s) for _ in range(8)))\n", |
| 114 | + " return a\n", |
| 115 | + "print(timeit.default_timer()-st)\n", |
| 116 | + "genp(10)" |
| 117 | + ] |
| 118 | + } |
| 119 | + ], |
| 120 | + "metadata": { |
| 121 | + "kernelspec": { |
| 122 | + "display_name": "Python 3", |
| 123 | + "language": "python", |
| 124 | + "name": "python3" |
| 125 | + }, |
| 126 | + "language_info": { |
| 127 | + "codemirror_mode": { |
| 128 | + "name": "ipython", |
| 129 | + "version": 3 |
| 130 | + }, |
| 131 | + "file_extension": ".py", |
| 132 | + "mimetype": "text/x-python", |
| 133 | + "name": "python", |
| 134 | + "nbconvert_exporter": "python", |
| 135 | + "pygments_lexer": "ipython3", |
| 136 | + "version": "3.7.3" |
| 137 | + } |
| 138 | + }, |
| 139 | + "nbformat": 4, |
| 140 | + "nbformat_minor": 2 |
| 141 | +} |
0 commit comments