New answers tagged

1

Z80, 59 bytes Input value in dehl. Output in c, 0, 1, 2, 3, 4 for ldr, mvn, mov, movw, movs respectively. Trashes b and a. This is indeed rather silly. 0E 03 7C B7 20 01 0C 7B B2 C8 AF 4F 3C F5 7A 2F 57 7B 2F 5F 7C 2F 67 7D 2F 6F 06 20 37 CB 7A 20 01 3F CB 15 CB 14 CB 13 CB 12 7C B3 B2 20 03 F1 4F F5 01 E8 F1 D8 37 3C F5 18 D3 foo: ld c,3 //...


2

MMIX, 96 bytes (24 instrs) Returns 8 for movs, else is a bitfield (1 for mov, 2 for mvn, 4 for movw). 0 is thus for ldr. I'm fairly certain that this can never return 6 or 7. 00000000: 3fff0008 4aff0003 e3010008 f8020000 ?”¡®J”¡¤ẉ¢¡®ẏ£¡¡ 00000010: 3fffff08 7301ff04 cf040000 e3050000 ?””®s¢”¥Ẇ¥¡¡ẉ¦¡¡ 00000020: fe020004 f2030003 f6040002 28010301 “£¡¥ṗ¤¡¤ẇ¥¡...


1

MMIX, 8 bytes (2 instrs) Really, just put in an xor command. 00000000: c600 0001 f801 0000 İ¡¡¢ẏ¢¡¡ xorflt XOR $0,$0,$1 POP 1,0 Simples.


2

JavaScript (ES6),  56  55 bytes Expects (N)(b), where b is φ(m). N=>b=>N.filter((_,i)=>((q=b[i>>4])>>7.5-i/2%8^~i)&q>=0) Try it online! Commented N => // outer function taking N[] b => // inner function taking b[] N.filter((_, i) => // for each entry at position i in N[]: ( ...


2

R, 80 62 54 52 bytes function(d,N)N[seq(b<-rawToBits(rev(d)))*2-rev(b<1)] Try it online! As per OP we don't need to handle cases when bits from φ select elements outside N. -4 bytes thanks to @Dominic function # a function (d, # taking first input as raw bytes (one of R data types) N) # and N as a ...


3

R, 86 83 82 bytes (or 64 bytes with additional NA values in output when length of hash result is greater than half the length of the private key N) function(f,N,d=seq(b<-sapply(f,function(b)b%/%2^(7:0)%%2))*2)N[(d-!b)*!d>sum(N|1)] Try it online! Input is an array f of single-byte integers (representing the output of the hash function phi) and an ...


Top 50 recent answers are included