from functools import reduce import binascii, gmpy2 from Crypto.Util.number import long_to_bytes
n = [ 0x8aa5dfa13fd16765b7a220eac8731dbc2865772496325b671e742ec391249bbddc4aaa3c8264a0ba5de8843d161dcbb5eb02813fcf14aab3ef315845228864b9fb426620bedb146237f2095adcaa233280bdd526aa2238e66b222c880fd4d78efacc56a887, 0x3eff009b4c43b714ff55f38fa16a633f266ca10e7500c568715d91b650573f66dcb6266be76da94b9ca7c394a9b65fed6e7b8522a1da640ce7033fd933aa1c3e4a1fd0747c1b17ec2fa1239299beaa269752944d7cc084ee145985f1, 0x698a394fbc84898d0a276f457de4166ffcb6c96736621de30892e66585da3077f7e6298f23fb31b511989692a1fd4d1ebc7ded8d35f93a80de69fb9ec1003af55484f5638215aa84866191df9baa56a394179f66243e803b0df8c789c8755eef4e431205264205 ] c = [ 0x3a4fe4c9a1318194d364e7a67b7e34dbb02c3f2e63f52b26bb8b3ef349807679c0ff95245187b5ddbc1baaa4a808137d456696cfb3ebe47b7853cec33c709d9ce8b46272f7b0b0e69dd4091920b968b8ad37686e24b800928732daf924f98945267cfd156a, 0x2ed28a3bb70af3820c5fc9e27f16b8d893ba578bcf1d879a32898c8e4e0f4b3fdf339889f9a44026de783786e62f1fe8fc25770bf89519c2fbd66d2cc6c02ffae8722b4391173993fa3f993b3318f07ca9a31df84a48959bfd0e06a, 0x63faaa3d6c3585425190d755347f6cd8913805f7edc551096322d105f24a6339c8f0ac1025db08cbda89195818acdeaea42a9273b10b874ec63e7d986f1172988a700308bc72f3d4531c9ec08e2ec06f5c00c54cc54d13b44ff33eb3851231fb591a0c15e220ac ] defCRT(mi, ai): assert(reduce(gmpy2.gcd,mi)==1) assert (isinstance(mi, list) and isinstance(ai, list)) M = reduce(lambda x, y: x * y, mi) ai_ti_Mi = [a * (M // m) * gmpy2.invert(M // m, m) for (m, a) in zip(mi, ai)] return reduce(lambda x, y: x + y, ai_ti_Mi) % M e=0x3 m=gmpy2.iroot(CRT(n, c), e)[0] m = long_to_bytes(m) s = str(m) print(s[::-1])
if file.content_type != "image/gif": logging.debug(f'Invalid Content type: {file.content_type}') flash('Content type is not "image/gif"', 'danger') return redirect(request.url)
if file and allowed_file(file.filename): filename = secure_filename(file.filename) file.save(os.path.join(app.config['UPLOAD_FOLDER'], file.filename))
mime_type = filetype.guess_mime(f'uploads/{file.filename}') if mime_type != "image/gif": logging.debug(f'Invalid Mime type: {mime_type}') flash('Mime type is not "image/gif"', 'danger') return redirect(request.url)