Urgent.News

What's breaking now, across hundreds of outlets.

Tech

TOTP in Node with no packages: four steps, each checked against RFC 6238

When an authenticator code is rejected, the fault sits in one of four steps: decoding the secret, turning the clock into a counter, the HMAC, or the truncation to six digits. Writing those four steps yourself is the quickest way to know which one to look at. Here they are in Node with no packages, each with a known answer to check against. The known answer is the test vector from RFC 6238. Its…

Two of four steps in authenticator code generation are examined: the Base32 secret decoding and clock conversion to a counter. The ASCII text 12345678901234567890 serves as the secret, provided in Base32 format as GEZDGNBVGY3TQOJQGEZDGNBVGY3TQOJQ. The current Unix time in seconds is divided by the period (typically 30 seconds) and the result, rounded down, serves as the counter. This counter is represented as 8 bytes, written using big-endian notation.

Rewritten by urgent.news; may contain errors — check the original.

Source: dev.to

Read the original at dev.to →

Report a problem with this story

More in Tech

How to know what a website is built with

You click around a site and wonder: is this WordPress, Shopify, something custom? Maybe you are researching leads, comparing a few competitors, or just curious.

  • View page source (Ctrl+U) to inspect HTML for CMS fingerprints
  • Paths like /wp-content/ suggest WordPress, /cdn/shop/ indicates Shopify
  • HTTP headers reveal server software (Nginx, Cloudflare, etc.)

Move your custom video player into Document Picture-in-Picture (controls included)

TL;DR video.requestPictureInPicture() only takes the <video> , so your custom controls vanish. documentPictureInPicture.requestWindow() opens an always-on-top window you fill with your own DOM.

  • Custom video players can now use Document Picture-in-Picture (PiP) with active controls.
  • openDocPip function creates new document window for PiP view using requestWindow() method.
  • Event listeners ensure smooth transition of player between PiP and main document modes.

Fix sideways and squashed phone uploads: read FFmpeg's display matrix before you scale

TL;DR Portrait phone videos usually store landscape frames plus a display matrix that says "rotate on playback". We'll reproduce the three ways pipelines break it (wrong orientation from ffprobe , a…

  • Smartphone videos store display matrix indicating rotation
  • Pipelines often misread or drop rotation information
  • Fix by consulting FFmpeg's display matrix before scaling

More from Thursday 26 November →