- Category: Web
- Impact: Medium
- Solves: 20
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
def sh1(z): | |
h, l, p = ([0x67452301,0xEFCDAB89,0x98BADCFE,0x10325476,0xC3D2E1F0],lambda n,b:((n<<b)|(n>>(32-b)))&0xFFFFFFFF,lambda m:m+b"\x80"+b"\x00"*((55-len(m))%int(64))+(int(8)*len(m)).to_bytes(8,"big")) | |
for g in [p(z)[i:i+64]for i in range(0,len(p(z)),64)]: | |
w = [int.from_bytes(g[i:i+4],"big")for i in range(0, 64, 4)] | |
[w.append(l(w[i-3].__xor__(w[i-8]).__xor__(w[i-14]).__xor__(w[i-16]), 1))for i in range(16,80)]; a, b, c, d, e = h | |
for i in range(80):e,d,c,b,a=d,c,l(b,30),a,l(a,5)+(b&c|~int(b)&(d),b.__xor__(c).__xor__(d),b&c|b&d|c&d,b.__xor__(c).__xor__(d))[i//20]+e+(0x5A827999,0x6ED9EBA1,0x8F1BBCDC,0xCA62C1D6)[i//20]+w[i]&0xFFFFFFFF | |
h = [(h[i]+[a, b, c, d, e][i])&0xFFFFFFFF for i in range(5)] | |
return int(sum(x<<(32*i)for i, x in enumerate(h[::-1]))).to_bytes(20,"big") | |
print("".join("LRUD"[int.from_bytes(sh1(bytes.fromhex("012345678999")+b"\x19\xa5\x7f\x15")[:2]+sh1(bytes.fromhex("012345678999")+b"\x03\x8f\xa5g\x00\x00")[:2],"big")>>30-2*i&3]for i in range(16))) # ULLDRLLUDLRLDDDL |
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
asr_model = __import__("nemo").collections.asr.models.EncDecMultiTaskModel.from_pretrained("nvidia/canary-1b") | |
asr_model.encoder.change_attention_model("rel_pos_local_attn", [128, 128]) | |
asr_model.encoder.change_subsampling_conv_chunking_factor(1) | |
asr_model.to(__import__("torch").device("cuda:0")) # cpu | |
print(asr_model.transcribe(audio="long_audio.wav", batch_size=4*4)) |
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
from qiskit import Aer, ClassicalRegister, QuantumCircuit, QuantumRegister, execute | |
from qiskit.tools.monitor import job_monitor | |
from random import choice, randint # from qiskit.circuit.library import U3Gate | |
chunk_size = 16 | |
expected_key_length = 10 | |
delta = 2 * chunk_size | |
roundtrips = (4 * expected_key_length + delta) // chunk_size | |
alice_qubits = QuantumRegister(chunk_size, name="q") | |
alice_bases = ClassicalRegister(chunk_size, name="b") |