Groovy web console

subscribe to the feed Subscribe
to this
site
Untitled (via #groovywebconsole)
tweet this snippet Tweet
this
script

Untitled

Published 3 months ago by Anonymous
Actions  ➤ Edit in console Back to console Show/hide line numbers View recent scripts
BitSet s = new BitSet()
[0..2, 4..7, 9..12, 19..21, 22..23, 24..32].each {
  s.set it.fromInt, it.toInt
}
s.flip 0, 32
MAGIC = s.toLongArray()[0] as int

def street = (578029824 >>> 8) ^ MAGIC
def building = (((2864516 * (11006337 ^ MAGIC) ^ MAGIC) >>> 2) ^ MAGIC) << 2
def apartment = (2**7 | 2**20 | 2**11 | -16777216 | 2**19 | 2**22 | 2**10 | 2**9 | 2**6) ^ MAGIC
apartment -= apartment * 2
apartment -= 1

[Integer.toHexString(street), building, apartment]