News for hackers. Stuff that matters.
Re:BlurHash: Algorithm to generate compact representation of... by lvh on Thursday February 20, 2020 @09:30AM (#22375287)
1. Using the hashes as principal indices seems unsafe in general (which includes image upload) anyway: it looks pretty simple to generate collisions. The suggested use case (save the hash in the database next to the original image or a reference to it) sounds fine.

2. Which disallowed characters? The dictionary appears to be "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz#$%*+,-.:;=?@[]^_{|}~". No slashes or null bytes, which are the common disallowed characters on server platforms. It does have characters your shell cares about, but that's only a problem if you're not quoting.

Re:BlurHash: Algorithm to generate compact representation of... by css on Thursday February 20, 2020 @09:38AM (#22375340)
`:` is disallowed on MacOS and several of those characters are disallowed on Windows. Generally I view images on a frontend, not on my servers.
Re:BlurHash: Algorithm to generate compact representation of... by lvh on Thursday February 20, 2020 @09:41AM (#22375359)
Fair! I would not expect the image be saved to a Windows path when displaying a blurred image in the example use cases (mobile apps and web pages). You're thinking Electron, perhaps?

Point of order though: I don't think that's right for MacOS, though you're certainly right for Windows. HFS+ lets you use any Unicode symbol including NUL (because the filenames are encoded Pascal-style). I don't know the details how how APFS does it, but it also appears to support any Unicode code point, though it additionally mandates UTF-8. [0]

[0] https://developer.apple.com/library/archive/documentation/Fi... grep "filenames"

Re:BlurHash: Algorithm to generate compact representation of... by css on Thursday February 20, 2020 @09:54AM (#22375438)
Interesting, I was not aware about MacOS. If I run `touch :.:` it will run fine and create the file, but Finder disallows this for whatever reason:

    The name “:.:” can’t be used.
    Try using a name with fewer characters, or with no punctuation marks.
Re:BlurHash: Algorithm to generate compact representation of... by DagAgren on Thursday February 20, 2020 @10:19AM (#22375631)
Finder exchanges : and / in filenames, for compatibility with classic MacOS, which used : as a directory separator and allowed / in filenames. You can create a file named / in Finder, and it will show up as : on the file system.
Re:BlurHash: Algorithm to generate compact representation of... by _kst_ on Thursday February 20, 2020 @01:41PM (#22377434)
A file name with an embedded NUL character couldn't be passed to fopen(), or to any other function that takes a pointer to a C-style string. (Not directly relevant here.)
Re:BlurHash: Algorithm to generate compact representation of... by DagAgren on Thursday February 20, 2020 @10:18AM (#22375624)
: was disallowed on classic MacOS. On modern macOS, it is allowed in the POSIX layer just fine. However, Finder and other parts of the UI will translate a : in the file name to a / on display, and vice versa.

This is because classic MacOS used : as a directory separator instead of /, and this behaviour is preserved in the UI, but obviously not in the underlying layers.

Re:BlurHash: Algorithm to generate compact representation of... by Wowfunhappy on Thursday February 20, 2020 @12:08PM (#22376538)
Is it not present in the underlying layer anymore? Applescript displays paths with : separators unless you specifically tell it you want a “POSIX path”. (This is actually really annoying.)
Re:BlurHash: Algorithm to generate compact representation of... by DagAgren on Thursday February 20, 2020 @12:12PM (#22376581)
No, the underlying layer is POSIXy, and uses /. The highest UI layers do the mapping between : and /, and apparently also AppleScript.
Re:BlurHash: Algorithm to generate compact representation of... by cosmojg on Thursday February 20, 2020 @01:21PM (#22377233)
Simple solution: run a POSIX-compliant OS on the frontend. All Linux distributions, all BSD distributions, modern macOS, and Windows Subsystem for Linux all support ':' in filenames.
Re:BlurHash: Algorithm to generate compact representation of... by joosters on Thursday February 20, 2020 @09:42AM (#22375367)
':' works fine in MacOS file names for me.