#x86 + rdrand, 19 bytes
x86 + rdrand, 19 bytes
Straightforward implementation. Takes input K in ecx and outputs to a buffer in ebx.
0000000a <start>: a: 0f c7 f0 rdrand %eax d: 31 d2 xor %edx,%edx f: f7 f1 div %ecx 11: 89 13 mov %edx,(%ebx) 13: 83 c3 04 add $0x4,%ebx 16: 89 d1 mov %edx,%ecx 18: 85 c9 test %ecx,%ecx 1a: 75 ee jne a <start> 1c: c3 ret