Platform
Resources
Pricing
Sign in
Get started
Mike Bostock
Visualization toolmaker. Founder @observablehq. Creator @d3. Former @nytgraphics. Pronounced BOSS-tock.
Workspace
Fork
Published
By
Mike Bostock
Edited
Mar 17, 2022
1 fork
Importers
30 stars
Insert cell
2
Insert cell
3
decrypt
(
"i+bqT/CxfJpw41fiWQ=="
)
Insert cell
async
function
decrypt
(
message
)
{
return
decode
(
await
crypto
.
subtle
.
decrypt
(
{
name
:
"AES-CTR"
,
counter
:
new
Uint8Array
(
16
)
,
length
:
16
*
8
}
,
key
,
unbase64
(
message
)
)
)
;
}
Insert cell
3
Insert cell
Insert cell
1
encrypt
(
input
)
Insert cell
async
function
encrypt
(
message
)
{
return
base64
(
await
crypto
.
subtle
.
encrypt
(
{
name
:
"AES-CTR"
,
counter
:
new
Uint8Array
(
16
)
,
length
:
16
*
8
}
,
key
,
encode
(
message
)
)
)
;
}
Insert cell
Insert cell
newKey
=
crypto
.
subtle
.
exportKey
(
"jwk"
,
await
crypto
.
subtle
.
generateKey
(
{
name
:
"AES-CTR"
,
length
:
256
}
,
true
,
[
"encrypt"
,
"decrypt"
]
)
)
Insert cell
Insert cell
key
=
crypto
.
subtle
.
importKey
(
"jwk"
,
{
alg
:
"A256CTR"
,
ext
:
true
,
k
:
hash
.
slice
(
1
)
||
defaultKey
,
key_ops
:
[
"encrypt"
,
"decrypt"
]
,
kty
:
"oct"
}
,
{
name
:
"AES-CTR"
,
length
:
256
}
,
true
,
[
"encrypt"
,
"decrypt"
]
)
Insert cell
2
defaultKey
=
"change-me-change-me-change-me-change-me-pls"
Insert cell
hash
=
Generators
.
observe
(
notify
=>
{
const
hashchange
=
(
)
=>
notify
(
location
.
hash
)
;
hashchange
(
)
;
addEventListener
(
"hashchange"
,
hashchange
)
;
return
(
)
=>
removeEventListener
(
"hashchange"
,
hashchange
)
;
}
)
Insert cell
5
encode
=
(
string
,
encoding
)
=>
new
TextEncoder
(
encoding
)
.
encode
(
string
)
Insert cell
decode
=
(
buffer
,
encoding
)
=>
new
TextDecoder
(
encoding
)
.
decode
(
buffer
)
Insert cell
import
{
encode
as
base64
,
decode
as
unbase64
}
from
"@mbostock/base64"
Insert cell
Purpose-built for displays of data
Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Try it for free
Learn more
Fork
View
Export
Edit
Show 2 comments
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Show 3 comments
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
decrypt
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Show 3 comments
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
input
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Show 1 comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
encrypt
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
newKey
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
key
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
defaultKey
Show 2 comments
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
hash
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
encode
Show 5 comments
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
decode
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML