Live data from Hacker News

Google can keep its Chrome browser but will be barred from exclusive contracts

cnbc.com

661–663 of 663 posts

Re: Google can keep its Chrome browser but will be barred from exclusive contracts

#661

Earlier quoted context omitted.

Have you used Grok or ChatGPT in the last year? I can't remember the last time I got a nonsense response. Do you have a recent example?

Today, I asked Google if there was a constant time string comparison algorithm in the JRE. It told me "no, but you can roll your own". Then I perused the links and found that MessageDigest.isEqual exists.

Are you sure it was wrong? I haven't used Java in over a decade, but looking at the docs for that method, I see it is only define for byte arrays, not strings.

That's also what Grok says:

> Is there a constant time string comparison algorithm in the JRE?

No, the Java Runtime Environment (JRE) does not provide a built-in constant-time comparison method directly for String objects in the standard library. The String.equals() and String.equalsIgnoreCase() methods perform variable-time comparisons that short-circuit upon finding the first mismatch, which can be vulnerable to timing attacks in security-sensitive contexts like password or token verification. However, the JRE does include a constant-time comparison utility for byte arrays via java.security.MessageDigest.isEqual(byte[] digesta, byte[] digestb), introduced in Java 6 and documented as performing a comparison where "the calculation time depends only on the length of digesta [and] does not depend on the ... contents." This makes it suitable for secure comparisons against timing side-channel attacks. To use it for strings:

Convert both strings to byte arrays using a consistent encoding (e.g., UTF-8 via getBytes("UTF-8")). Ensure the byte arrays have the same length first (as the method requires equal-length inputs for meaningful results). Call MessageDigest.isEqual() on the arrays.

Re: Google can keep its Chrome browser but will be barred from exclusive contracts

#662

By the way, a pet peeve of mine right now is that reporters covering court cases (and we have so many of public interest lately) never seem to simply paste the link to the online PDF decision/ruling for us all to read, right in the story. (and another user here kindly did that for us below: https://storage.courtlistener.com/recap/gov.uscourts.dcd.223... ) It seems such a simple step (they must have been using the rul…

What if we made crowdsourced database of external links to sources? Like SponsorBlock for skipping sponsored sections in YouTube videos.

Re: Google can keep its Chrome browser but will be barred from exclusive contracts

#663

Earlier quoted context omitted.

Today, I asked Google if there was a constant time string comparison algorithm in the JRE. It told me "no, but you can roll your own". Then I perused the links and found that MessageDigest.isEqual exists.

Are you sure it was wrong? I haven't used Java in over a decade, but looking at the docs for that method, I see it is only define for byte arrays, not strings. That's also what Grok says: > Is there a constant time string comparison algorithm in the JRE? No, the Java Runtime Environment (JRE) does not provide a built-in constant-time comparison method directly for String objects in the standard library. The String.eq…

Strings _are_ bytes under the hood - this is the kind of "well, technically it's not wrong" that makes "ask an LLM" nothing like "Ask Linus" or even "Ask the intern".
Post reply on HN