Better HN
topnewbestaskshowjobs
Log inSign up

RaisingSpear

127 karma · joined Jun 8, 2020 (6y ago) · 99 submissions

Submissions

comment 1w ago · link · parent

> Xiaomi actually make rooting/flashing their phones reasonably easy

It used to be relatively easy, not so much any more: https://github.com/zenfyrdev/bootloader-unlock-wall-of-shame...

It's really sad to see the number of vendors friendly to bootloader unlocks dwindling over time.

comment 4w ago · link · parent

So if the definition is based off personal preference, how do you know mobile game players aren't gamers?

Mobile gacha/micro-transaction games often encourage frequent/repetitive play (e.g. via dailies, limited time quests etc). Would someone engaging in this likely consider the game to be a hobby?

comment 4w ago · link · parent

> they aren't "gamers," they're just people who sometimes play games

I thought that basically fits the definition of "gamer" so I'm clearly mistaken. How do you define "gamer"? Someone who "always" plays games? (for some definition of "always"?)

Regardless, non "gamer" game players can still benefit from higher refresh rate screens, and they're not insignificant in number.

comment 1mo ago · link · parent

It's worth pointing out that mobile gaming surpasses PC and console combined, in terms of marketshare and revenue. https://playercounter.com/gaming-industry-revenue-statistics...

I don't know how "mobile" gamers are using iPads (or tablets), but considering the size of the market, I doubt it's particularly niche.

comment 1y ago · link · parent

From memory, the SpacemiT K1 doesn't support extensions like Zvkt?

EDIT: okay, looks like the official documentation lists it, but many places I looked didn't. Maybe it wasn't being detected in cpuinfo?

comment 1y ago · link · parent

If you scale up the multipliers, you should be able to eliminate the variable shift, which would reduce the lookup table to 512 bytes.

comment 1y ago · link · parent

For CPUs that support AVX-512 VBMI, there's a faster reciprocal-based approach: https://avereniect.github.io/2023/04/29/uint8_division_using...

A VBMI2 example implementation can be found in the function named divide_with_lookup_16b: https://godbolt.org/z/xdE1dx5Pj

comment 2y ago · link · parent

I suspect Intel uses 32x32b multipliers instead of his theorised 16x16b, just that it only has one every second lane. It lines up more closely with VPMULLQ, and it seems odd that PMULUDQ would be one uOp vs PMULLD's two.

PMULLD is probably just doing 2x PMULUDQ and discarding the high bits.

(I tried commenting on his blog but it's awaiting moderation - I don't know if that's ever checked, or just sits in the queue forever)

comment 2y ago · link · parent

> Does every dev need to write the same line now?

Yes.

> Or should your one-liner be a library?

Definitely not.

Particularly if I can write the one-liner faster than it takes one to search, check, include and install the library.

comment 2y ago · link · parent

Yeah, you can write it in less than a minute:

const tryNew = (f, ...a) => {

  try {

   return new f(...a);

  } catch(x) {

   return undefined;

  }

 };
const myUrl = tryNew(URL, 'http://example.com/');

I don't get why JS devs like to whinge about the smallest things. And we get stuff like leftPad because of huge aversion to writing utility functions.

comment 2y ago · link · parent

Search engines: they scrape the web, but get narky when scraped themselves.

comment 2y ago · link · parent

Tangentially related, but I've had a case where GCC 9.4.0 shipped a broken arm_acle.h header [https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100985] - code which includes the header would always fail to compile.

Since users could be trying to compile it on GCC 9.4.0, and as the functionality dependent on the header isn't critical to the application, if the build detects the header is broken, it just disables the functionality and emits a warning.

Back to xz: If security isn't your top priority, it seems reasonable to just ignore the failure of an optional feature and just move along. Of course, in hindsight, it's easy to point fingers, but without that, it doesn't sound completely unreasonable to me.

comment 2y ago · link · parent

I think we're talking past each other a bit here.

If I were trying to phish someone, I wouldn't attack the public key crypto part, so how domains come into play during authentication doesn't matter. I'd just grab the "unencrypted" session token at the end of the exchange.

Even if you somehow protected the session token (sounds dubious), there's still plenty a phisher could do, since it has full MITM capability.

comment 2y ago · link · parent

From my understanding, FIDO isn't MFA though (the authenticator may present its own local challenge, but I don't think the remote party can mandate it).

There's also the issue of how many sites actually use it, as well as how it handles the loss of or inability to access private keys etc. I generally see stuff like 'recovery keys' being a solution, but now you're just back to a password, just with extra steps.

comment 2y ago · link · parent

The phisher can just pass on whatever you sign, and capture the token the server sends back.

Sure, you can probably come up with some non-HTTPS scheme that can address this, but I don't see any site actually doing this, so you're back to the unrealistic scenario.

comment 2y ago · link · parent

> That's why I qualified it with "certificate-based". The private key never leaves the device

Except that phishing doesn't require the private key - it just needs to echo back the generated token. And even if that isn't possible, what stops it obtaining the session token that's sent back?

comment 2y ago · link · parent

> I don't think phishing is such an obscure scenario.

For a typical person, maybe, but for a tech-minded individual who understands security, data entropy and what /dev/random is?

And I don't see how MFA stops phishing - it can get you to enter a token like it can get you to enter a password.

I'm also looking at this from the perspective of an individual, not a service provider, so the activities of the greater percentage of users is of little interest to me.

comment 2y ago · link · parent

But password managers typically don't send keyboard commands to fill in a password, so a physical device would be useless.

> There are plenty of scenarios where MFA is more secure than just a strong password.

And how realistic are they? Or are they just highly specific scenarios where all the stars must align, and are almost never going to happen?

comment 2y ago · link · parent

I don't quite understand what you're saying, but it should be possible to infer the length from the number of bytes received.

Assuming n is an integer:

  * 5n bytes received = 4n bytes data
  * 5n+1 bytes received is [invalid]
  * 5n+2 bytes received = 4n+1 bytes data
  * 5n+3 bytes received = 4n+2 bytes data
  * 5n+4 bytes received = 4n+3 bytes data
This is like modified Base64, which doesn't need any padding.

comment 2y ago · link · parent

Padding is actually not really necessary in base64, as you can infer the length from the number of characters received.

Unfortunately for Z85, they made the highly questionable decision to use big-endian, which means it can't take base64's route. You could probably define an incomplete group at the end to be right-aligned or similar, but you may as well be sensible and just go little-endian.

comment 2y ago · link · parent

> The four octets SHALL be treated as an unsigned 32-bit integer in network byte order (big endian). The five characters SHALL be output from most significant to least significant (big endian).

Why oh why??!

If it were little endian, you could probably skip the "must be multiple of 5 chars/4 bytes" requirement, not to mention that 99.9999% of processors out there are running in little-endian mode.

There is nothing "envious" about network byte order.

comment 2y ago · link · parent

Did the challenge limit submissions to only using SSE2? Seems odd, given the prevalence of SSE4.2 support.

PMULUDQ is in SSE2, though I haven't checked if that's usable for the problem here. There's also PMULLD in SSE4.1 if you only need a 32-bit result. But for summing digits, perhaps SSE2's PMADDWD could be sufficient?

comment 2y ago · link · parent

POPCNT doesn't exist in AVX prior to Icelake, so using other techniques there is sensible. Also, that's POPCNT, not LZCNT.

comment 2y ago · link · parent

> There are some times when you're doing these operations in large vector types (like AVX), in parallel, when falling back to the SWAR techniques can actually be faster because of limited bandwidth on the port for micro ops in popcnt or clz.

I'm doubtful of this in general. Some older processors did have a very slow BSF/BSR implementation, so it may be the case there, but I wouldn't generally stick with that assumption these days. (and it's most certainly not the case on AMD Zen, given all its ALUs can do these bit ops)

AVX doesn't have lzcnt prior to AVX-512 CD, so it could make more sense there, though I'd imagine that abusing float conversion (convert to float, extract exponent) would still be faster.

comment 2y ago · link · parent

> if your computer ever gets compromised

If that happens, nothing will save you. The malware can just grab your session tokens whenever you log in, then do whatever it pleases.

comment 2y ago · link · parent

> So far I couldn't exceed 1 GB/s/core [4], so more research is needed. If you have any ideas - I am all ears!

I don't know much about the space you're working in, but some things I'd point out:

* 32b and 64b SIMD multiplication have very high latency on Intel CPUs (actually, expect multiplication to have high latency in general on any CPU). If you're not using multiple independent chains of zmm registers, performance will suck

* _mm512_set_epi64 with memory sources likely performs poorly. See if you can do full vector loads and swizzle the data into position (i.e. unpack/shuffle operations)

* do you really need to split the string into 4 parts? Can you just use the same "part", but offset each lane by a byte?

* what about CRC64? Like 32/64b multiplication, CLMUL/PMULL instructions tend to have high latency, so might not help on that front, but there may be other benefits

comment 2y ago · link · parent

> Under no circumstances should FLAC level 5 decode be faster than FLAC level 0 decode.

I don't know about FLAC, but from my knowledge of compression, this result seems sensible to me.

Smaller file = less bits to process = faster. FLAC level 5 is expected to give a smaller file than level 0, so it makes sense that decoding it will be faster. Of course, it's possible that some codecs enable more codec features at higher compression levels, which makes decoding slower, so it's not always a given, but higher compression giving faster decode doesn't seem unreasonable.

comment 2y ago · link · parent

Certainly, if your aim is the simplest code with no regard to compression, you could achieve a PNG writer with a small amount of code.

In such a case, you could also skip the PNG filtering as well (whilst for my case, you wouldn't want to).

I think it'd make more sense to go with BMP for a 'simple as possible' image format, that has wide support, than with PNG. PNG is definitely more geared towards a compressed image (as well as all sorts of other features you may not care about).

1234