Is there a PCI Requirement for shuffling digits while accepting PIN?

The following image shows a PIN entry device which shuffles the digits.

. via twitter

I’ve seen this question, but it doesn’t cover why companies are still doing this.

I looked at the POS PIN Entry Device and the Software-based PIN Entry on COTSSecurityRequirements requirements and neither of them seems to have anything about shuffling the digits.

Is there a requirement or specification that I’m missing?

Serialization functions: accepting a sink versus returning the result

What are the pros/cons of having a serialization function accept a sink:

class Foo:   def toString(self, stringIOSink):     pass    def toBytes(self, byteSink):     pass 

versus having the serialisation function return the result:

class Foo:   def toString(self):     # ..     return s    def toBytes(self):     # ..     return bytes 

(obviously this approach is the standard when serialising to string)

I’ve seen both in the wild and up until now have never given it much thought. Note my examples are in python, but I’m asking in a language agnostic context.

Considerations I’ve thought of:

accepting a sink

  • implementation does not need to allocate memory (and thus client does not need to worry about how memory is managed)
  • can stream output

returning result

  • arguably simpler
  • allows you to further manipulate/use the returned result. EG if we are serializing to JSON (similar to Python’s JSON decoding operation), then if Foo holds a list of Bar objects, then we can implement Foo‘s toJSON method by:
def toJSON(self):     return {         #  other members here         "bars": [b.toJSON() for b in self.bars],     } 

Which wouldn’t be possible if toJSON accepted some sort of JSON sink.

Why has my Mac stopped accepting mouse clicks?

My Mac mini suddenly stopped responding to mouse clicks. The cursor moves around and I can switch applications with the keyboard but neither my magic trackpad or cheap USB mouse work for any type of click. As I move the most cursor along the dock icons are not ‘popping’ neither are any mouse hover actions seeming to work.

I never saw this before, what is going on? I don’t know how to use my Mac without a mouse so I’m a bit stuck!

Dove tailing questions about accepting language

$ L = \{M | \text { M is a TM and there exist some string w that contains five 1’s such that M halts}\}$

Where $ \Sigma =\{0,1\}$

let $ w_1, w_2, \cdots, \in \Sigma^*$ be an effective enumeration. We give a TM $ R$ that recognizes $ L$

R = "On input <M>     for s = 1 to infinity:         for i = 1 to s             run M on input w_i for s steps             if M halts on w_i within s steps then                 accept 

Can I assume $ M$ knows to halt only if there are five $ 1$ ‘s? Or do I need another if statement such as in line 4

if M halts on w_i within s steps then     if w_i.count("1") is 5 then         accept 

DFA multiple accepting states to Regular expression

I am trying to find the regular expression that defines this DFA, I am finding this particular case difficult since it has multiple accepting states.

If I understand this DFA correctly, it recognises:

empty strings or strings with any number of b => b*

or

a followed by any number of b => ab* or aa followed by any number of b => aa(b*)

So the closest I have got is b*+(a+aa)+(a+aa)b* but I know this is not correct, since it doesn’t recognise strings such aabaabab.

enter image description here

I have been using http://ivanzuzak.info/noam/webapps/fsm_simulator/ so I can see I don’t know how to make the transition back to Q0 from Q1 or Q2 when there is a b.

Could anybody help me finding where I’m going wrong and how could I fix it?

Many thanks in advance.