Axman6 | 🇦🇺

157 Followers
375 Following
474 Posts
Haskell hacker
~Studying CyberSecMasters@UNSW~
Crypto(graphy: 👍 | currency: 👎)
ACT SES volley
@Axman6@🦤 and everywhere else
🦋https://bsky.app/profile/axman6.au
@huwr @damonism hello! Also not out tonight, too busy in Melbourne for the Hilltop Hoods 😅
@shapr That sounds like a fantastic thing, though I’d usually be asleep at 7:00am 😅 I’d love an invite though, on the off chance I can make it - what’s the best way to send (not publicly) send you my email?
Maybe I need to organise something similar too…

@riskybusiness @metlstorm

(Reposting from bsky because it seems pretty dead there)

I’ve been thinking for a long time now that there’s a Riskyverse podcast missing - every time Adam talks about a hack or some new exploit, the five min discussion each week is never enough. Have you guys considered the Metl pub chat pod?

Basically, I want the “Adam, let me buy you a beer, let’s talk about cool shit” pod. As someone who works from home, I miss the down in the weeds tech chats I used to have.

Keen to hear your thoughts, I know putting together a new podcast is a lot of work, but I also think that plenty of your sponsors would love to be able to get into the details of why their tech is cool.

Anyway, I love all the pods, they’re top of my VIP list in overcast so I get them right away.

@shachaf @pkhuong I’m not sure I understand your point, Okasaki’s whole book is dedicated to exactly the topic of evaluating the cost of lazy languages, and showing the actual costs by being careful about which values are evaluated when (in the case of queues it uses a really cleaver trick to evaluate the reversing of the input list one step at a time as the output is popped)

As I was replying, I realised that what I’m suggesting is basically exactly what the code actually does, I’d missed the “staging product” being kept around, for exactly the purpose I’m going through below. I’m going to keep it because I spent like half an hour writing it, and at the very least it’s something I can refer to in the future.

This can definitely be done by using a few stacks, if you have laziness available, I’ll have to see if I can make the Haskell version work as I expect, it’s not a big change from classical Okasaki queues at all, except with the addition of the A/B tags below.

—— feel free to stop reading here ——

Anyway, the point I’m making is that at any time after you take the ingestion queue and add it to the end of the excretion queue, the monoid product of all the old values, eg a!c, b!c plus the sum computed in the ingestion list d!f, plus whatever has been computed in the ingestion queue h!k is the total product. So in your case, when using mutable arrays, you can stop moving the write pointer once you’ve reached the old elements, i.e, c, as long as you hold onto the sum d!f. You don’t need to keep updating at that point.

You just store d!f when you start moving the write pointer and mark each element in the excretion list with a tag saying whether it’s an old or a new item (which is part of the work done with the write pointer). This can be done by just using a single bool or enum A or B to signify if the value in the excretion list needs the have the stored d!f added to it or not:

lastSum = d!f // computed during ingestion
currentPhase = B
excretion = [(A, a, a!c), (A, b, b!c), (A, c, c!c), (B, d, d!f), (B, e, e!f), (B, f, f!f)]
ingestionSum = …
ingestion = […]

def dequeue():
If phaseOf(excretion[0]) = currentPhase:
currentPhase = switch(currentPhase)
lastSum = ingestionSum
<do what ever bookkeeping is needed to empty ingestion and start moving them to the end of the excretion list, reset write pointer etc.>
ingestionSum = 1
ingestion = []
<update pointer for the head>
// the important part:
return sumFor(excretion[0]) + lastSum + ingestionSum
else:
<update pointer for the head>
// The other important part - we don’t need use the lastSum because it’s already part of what’s been computed - the head of the queue must have computed d!f as well, we we could set lastSum = null now
return sumFor(excretion[0]) + ingestionSum

I’m just trying to understand if there’s a reason to recompute d!f again when it’s been computed once during ingestion and them seemingly thrown away. As long as you maintain the invariants that you will always have moved the write pointer up the first place where B occurs by the time you dequeue it, you end up with the same monoidal product*, but you do less work because you don’t need to add d!f to a!c - c!c except when you dequeue

  • or sum - we usually talk about monoidal sums in Haskell land for some reason, which is why I’ve used sum and + here.

@shachaf @pkhuong laziness is the thing that makes Okasaki queues work, by carefully controlling what is evaluated when, to get O(1) enqueue and dequeue.

But the observation I made from your post was that I think you’re doing more work than you need to - all the values in the old excretion list when combined with the product calculated for the product of the new tail of the new list (the previous ingestion list’s product), and the current ingestion list’s product makes the total product. So you just need to know when you’ve reached the end of the old excretion list, which can be done with an extra bool per item.

@pkhuong @shachaf I just finished reading this, and it feels to me that the idea that we can’t use stacks might be wrong - the classic Okasaki three-stack O(1) purely functional queue feels very similar, the function that handles reversing the of the ingestion-to-staging process, which appends to the end of the old excretion queue seems to be sitting at exactly the right place to be computing the write pointer data, at least for the staging data.

It also feels like you don’t need to actually write into the old-excretion stack at all, as long as you keep a reference to the ingestion product as you’re reversing, the monoid product of any of the old ingestion values is always its current product, times the old ingestion product, times the current product.

I feel I need to go build this in Haskell now (though I feel like @shachaf would have beaten me to that). I’ve probably missed something important though.

@jaypowerbi
"Hey Copilot, are we committing fraud anywhere?"
"All signs point to no" 🎱
"Great, thanks"
I just added a copy of my slides for my "We are currently clean on OPSEC" DEFCON talk here, in case you're interested https://micahflee.com/we-are-currently-clean-on-opsec-the-signalgate-saga/
"We are currently clean on OPSEC": The Signalgate Saga

I just gave my first solo main stage DEFCON talk, about Signalgate, and I think it was a resounding success! The room was packed – apparently people were waiting outside to get in. I got tons of positive feedback, and no negative feedback (though, someone told me a boomer sitting next

micahflee

@wezm Thanks, as always, Wes, for a great response to my public whinging 😄 I'll check out the forum and see what they have to say.

I agree with the level of security assessment for BitWarden, this is the main thing which keeps me using 1Password - every other part of the experience of the app has been going down hill, 1Password 8 was, and continues to be, an awful user experience. I'm constantly lost trying to find the sections I'm looking for when they were always right there in v7.

And as you've pointed out in the past, the use of Electron is deeply troubling, and always reminds me of

@paul @1password 1 second? Consider yourself lucky! I get minute+ beachballs all the time.