add delay in hasher and rng

This commit is contained in:
Jerome Petazzoni
2015-06-07 19:53:14 -07:00
parent fae45aae43
commit 89abfeefeb
3 changed files with 15 additions and 1 deletions

View File

@@ -1,6 +1,7 @@
from flask import Flask, Response
import os
import socket
import time
app = Flask(__name__)
@@ -19,6 +20,8 @@ def index():
@app.route("/<int:how_many_bytes>")
def rng(how_many_bytes):
# Simulate a little bit of delay
time.sleep(0.1)
return Response(
os.read(urandom, how_many_bytes),
content_type="application/octet-stream")