mirror of
https://github.com/morgan9e/blog
synced 2026-04-14 00:04:07 +09:00
Reset
This commit is contained in:
@@ -0,0 +1,66 @@
|
||||
+++
|
||||
date = 2021-05-21T13:18:27Z
|
||||
description = ""
|
||||
draft = false
|
||||
aliases = ["/archive/pyphy-mulrienjin-1pyeon-gibon-aidieo/"]
|
||||
title = "파이썬으로 구현한 뉴턴의 방정식과 적분방정식"
|
||||
math = true
|
||||
+++
|
||||
|
||||
|
||||
우리의 세계에서 물체의 역학적 운동을 지배하는, 지배방정식이 있죠.뉴턴의 법칙, 방정식입니다.뉴턴의 법칙은 총 세개의 방정식이 있죠. 이 세가지 법칙만을 이용해서 물체의 운동을 계산할 수 있습니다.이것을 바탕으로 만들어진 역설이 라플라스의 역설이죠. 만약 모든 분자의 가속도, 속도, 위치 세가지 정보를 알고 있다면, 뉴턴의 법칙에 근거하여 그 다음 상황을 예측할 수 있고, 따라서 이 세상, 아니면 그것을 넘어서서 모든 분자의 정보를 알 수 있습니다.우리가 여기서 분석할 것은 가장 쉬운 법칙, 뉴턴의 제 2법칙, 가속도의 법칙입니다.뉴턴의 가속도 법칙은 $ F = \frac{dp}{dt} $ 로 표현할 수 있습니다. 이 법칙에 의하면, 질량의 변화가 없는 물체에서, $ a $ 는 $ F$ 에 비례합니다. 따라서 각 순간 물체에 작용하는 힘의 크기를 안다면, 그 물체의 가속도를 알 수 있겠죠?
|
||||
|
||||
이때, 가속도와 속도, 변위의 정의를 이용하면 $ a = \frac{dv}{dt} $ 이고, $ v = \frac{dx}{dt} $입니다.가속도를 안다면 적분을 통해 속도를 알 수 있고, 속도를 안다면 변위를 알 수 있죠.정상상태에서는 물체에 작용하는 힘의 방정식을 구할 수 있습니다. 이것을 질량으로 나눠 가속도를 얻을 수 있고, 속도와 변위의 방정식을 얻을 수 있습니다.
|
||||
|
||||
하지만, 컴퓨터는 대수적으로 적분할 수 없습니다. (물론 할 수 있는 알고리즘도 있지만 불완전하죠)그렇다면 어떻게 각 시점에서 가속도의 값을 알고, 속도와 변위의 값을 알 수 있을까요?이렇게 미분방정식을 통해서 각 시점의 이산적인 변수값을 알 수 있도록 하는 것이 오일러 근사법입니다.오일러 근사법을 통틀어 이렇게 수치적으로 방정식을 해석하는 학문을 통틀어 수치해석학이라고 합니다.이렇게 물리를 시뮬레이션 하거나 컴퓨터로 해를 구할 때는 수치해석학을 사용합니다.
|
||||
|
||||
|
||||
|
||||
### 오일러 방정식이란,
|
||||
|
||||
$$ \frac{dy}{dx} = f(x) $$라고 표현되어지는 미분 방정식이 있을 때, 오일러 근사법을 이용하면 일정한 지점의 $y$ 값을 근사로 구할 수 있습니다.
|
||||
|
||||
$$ y_{n+1} = y_n + \frac{dy}{dx}|_{x_n} \Delta x $$ 라는 식으로 말이죠.
|
||||
|
||||
이 식을 이용하면 특정 원점으로부터 $\Delta x$만큼의 일정한 간격을 띄어가며 $y$ 를 근사할 수 있습니다.
|
||||
|
||||
|
||||
|
||||
이 방법으로 물체에 작용하는 힘을 알 때 변위와 속도를 구할 수 있습니다. 특정 $\Delta t$를 기준으로 $\Delta$의 $n$배만큼의 시점에서 구할 수 있습니다.
|
||||
|
||||
$$ v_{n+1} = v_n + \frac{dv}{dt}|_{t_n} \Delta t $$
|
||||
|
||||
$$ x_{n+1} = x_n + \frac{dx}{dt}|_{t_n} \Delta t $$
|
||||
|
||||
으로 말이죠..
|
||||
|
||||
|
||||
|
||||
### 이제 파이썬으로 오일러 근사법을 구현해 봅시다.
|
||||
|
||||
이렇게 데이터의 배열끼리의 연산을 취급할 때에는 파이썬의 수치분석 모듈인 Numpy를 사용합니다. 하지만, 간단한 시뮬레이션에서는 파이썬 기본으로도 충분합니다. 그래프를 표현하기 위해 matplotlib과 수식을 위해 math를 이용합니다.
|
||||
|
||||
```python
|
||||
import matplotlib.pyplot as plt
|
||||
import math
|
||||
x0 = 0.0
|
||||
y0 = 1.0
|
||||
dx = 0.01
|
||||
step = 1000
|
||||
dydx = lambda x, y: 1/y
|
||||
x = [x0 + dx*i for i in range(step)]
|
||||
y = [y0]
|
||||
|
||||
for n in range(step-1):
|
||||
y.append(y[n] + dydx(x[n],y[n]) * dx)
|
||||
|
||||
plt.plot(x, y)
|
||||
plt.grid()
|
||||
plt.xlabel("x")
|
||||
plt.ylabel("y")
|
||||
plt.legend()
|
||||
plt.show()
|
||||
```
|
||||
|
||||
{{< figure src="https://blog.kakaocdn.net/dn/KMPAl/btq9fmV0ntZ/HPdiTkaknSISR4yGvxKUSK/img.png" caption="$ \frac{dy}{dx} = \frac{1}{y} $" >}}
|
||||
|
||||
314
content/archive/2021-07-09-cryptography.md
Normal file
314
content/archive/2021-07-09-cryptography.md
Normal file
@@ -0,0 +1,314 @@
|
||||
+++
|
||||
date = 2021-07-09T10:24:00Z
|
||||
description = ""
|
||||
draft = false
|
||||
title = "Cryptography"
|
||||
|
||||
+++
|
||||
|
||||
|
||||
## **Cryptography**
|
||||
|
||||
### **공개키 암호화 알고리즘.**
|
||||
|
||||
#### 1. Diffie-Hellman
|
||||
|
||||
디피-헬먼 키 교환 방식은 암호화 통신을 위한 키를 교환하는 방식 중 하나이다. 두 통신 주체가 공통의 비밀 키를 사용할 수 있도록 하는 안전한 알고리즘이다. 디피-헬먼 방식은 기초적인 암호 통신 방법으로, 이 알고리즘에 RSA나 ECC같은 암호화 알고리즘을 합쳐서 암호화 통신이 성립된다. 공개키는 암호화할 수 있는 키이고, 개인키는 복호화할 수 있는 키이다.
|
||||
|
||||
디피-헬먼 키 교환은 공개키 암호화 방식에 기반한다. 공개키 암호화 방식이란, 자신의 공개키를 상대방에게 전송하고, 그 상대방은 그 공개키로 데이터를 암호화해서 전송하면, 자신은 자신의 개인키로 복호화 할 수 있어, 통신이 성립되는 방식이다. 이때 상호통신을 위해서는 서로의 개인키를 공개키를 이용하여 공유하고, 각각 공유한 개인키와 공유키를 이용하여 공통된 비밀키를 계산하여 그것으로 통신하거나, 서로 각자의 개인키로 복호화하여 통신할 수 있다. 공통된 비밀키를 사용한다면 대칭 키 알고리즘, 서로 다른 키를 사용한다면 비대칭 키 알고리즘이라 한다.
|
||||
|
||||
디피-헬먼 키 교환 방식은 이산수학의 난해성에 기초한다. 먼저, 상호에 매우 큰 소수 P와 임의의 정수 N을 교환한다. 이는 공개적으로 전송해도 문제가 없다. 이때, 서로 P보다 작은 정수 a, b를 임의로 설정하고, N의 a, N의 b승의 mod P를 서로 전송한다. 이후에, 서로 전송받은 N의 b, a승 mod P를 자신이 가지고 있는 정수 a, b를 이용해 N의 b승의 a승과 N의 a승의 b승 mod P를 계산한다. N의 ab승과 N의 ba승은 지수법칙에 의해 동일하므로 이 값을 서로 공통의 비밀키로 사용할 수 있다.
|
||||
|
||||
위 상황에서 중간의 사람은 N과 P, N의 a, N의 b승의 mod P를 알 수 있다. 키 값을 알기 위해서는 N^ab mod P를 구해야 하는데, 이를 위해서는 a나 b 둘 중 하나는 알아야 한다. 여기서, 이산수학의 난해성에 의해 중간자는 a, b값을 알 수 없고, 이에 기밀성이 유지된다.
|
||||
|
||||
하지만, DH알고리즘은 가장 중요한 취약점이 있다. MITM공격에는 아주 무력하고, 기밀성만 보장할 뿐 무결성, 인증 등 기타 보안의 필수 조건을 만족시키지 못한다. 인증이란, 서로간의 정체를 확실이 하는가에 대한 문제이다. MITM 공격이란, 중간에 다른 사람이 송신자의 정보를 가로채고, 수신자에게 위조된 정보, 즉 자신의 계산값을 전송하는 상황에서 일어난다. 이때 수신자는 그 정보가 중간자가 아닌 송신자에게서 온 정보라 믿고 비밀키를 만들 것이고, 이에 중간자는 그 비밀키를 알게 된다. 받은 정보가 제대로 된 송신자에게서 온 정보인지 확신할 수 있어야 한다는 것이 인증의 개념인데, 디피-헬먼 키 교횐은 이러한 방법이 없다. 이러한 취약점을 해결하기 위해 DH와 RSA, ECDH등 다른 암호화 알고리즘과 합쳐서 PKI 등을 사용하는 것이다.
|
||||
|
||||
#### 2. RSA
|
||||
|
||||
RSA는 일반적으로 알려져 있듯이 매우 큰 소수는 소인수 분해할 수 없다. (매우 힘들다)는 것을 기초로 하고 있다. RSA는 이 방식의 개발자인 세 사람 이름의 앞글자를 따서 만들어 졌다. RSA도 DH와 마찬가지로 공개키 암호화 알고리즘이다. 현재 인터넷에 사용되는 거의 모든 보안 체계는 RSA이며, 이는 RSA가 오랫동안 인정된, 안정적인 암호화 알고리즘이라는 뜻이다.
|
||||
|
||||
원리를 바로 설명하자면, 서로 각자 매우 큰 소수 p, q를 준비한다. (p-1), (q-1)과 서로소인 e에 대해, ed mod (p-1)(q-1)이 1인 d의 값을 찾고, N=pq와 e를 공개한다. 이들이 공개키가 되고, d는 개인키가 된다.
|
||||
|
||||
공개키 N, e로 평서문 m을 암호화하기 위해서는 m^e mod N을 계산하면 된다. 개인키 d를 가지고 있는 사람이 이를 복호화 하기 위해서는 $ (m^e)^d mod N $을 계산하면, m을 알아낼 수 있다. 이 고정에서 페르마의 소정리가 이용되는데, 페르마의 소정리란, 어떤 수 N이 있을 때, 이 수와 서로소인 수 a에 대하여, $ a^{\phi(N)} = 1 \mod N $가 성립한다는 법칙이다. 이때 $ \phi(n) $은 오일러 파이 함수로, 1-N까지궁 N와 서로소인 수의 개수를 의미한다. N이 두 소인수로 이루어진 합성수라면, $ \phi(N) = (p-1)(q-1) $로 나타난다. 바로 이 값을 이용해서 복호화를 진행한다. $ E*d $ 는 $ (p-1)(q-1)A + 1 $ 로 나타낼 수 있고, 따라서 $ m^(ed) = m^(A(p-1)(q-1) +1) $인데, $ m^(p-1)(q-1) $은 1이므로, 이 값이 $m$이 된다.
|
||||
|
||||
$M^e mod N$과 $N, $e로는 원문 $m$과 개인키 $d$를 계산할 수 없다. 이를 계산하기 위해서는
|
||||
|
||||
RSA암호화 알고리즘과 DH알고리즘의 차이가 별로 없다고 생각할 수 있다. 뭐 알고리즘 상으로는 비슷하다. 다를게 없다. 하지만 제일 중요하게 다른 것은, RSA의 경우는 공개키와 비밀키를 메시지를 암호화할 때 사용한다는 것이고, DH는 개인키와 공개키를 이용하여 새로운 공통의 비밀키를 만든다는 점이다. 따라서, DH와 RSA의 차이는 키들의 용도이다. 애초에 DH는 키를 교환하는 방식이고 RSA는 암호화/복호화 알고리즘이니까 용도가 다르지만.
|
||||
|
||||
RSA도 마찬가지로 MITM에 매우 약하다. 오는 정보에만 의존해서 키를 사용하기 때문이다. 따라서 RSA도 인증의 면에서는 부족한 암호화 알고리즘이며, 이를 해결하기 위해서 PKI, Public Key Infrastructure를 사용한다. 이는 사람들의 공개키를 한 인증기관이 모아서 관리하여, 상호에 신원을 보장해주는 방식이다. 송신자는 이 인증기관에 수신자의 공개키를 조회하여, 제대로 된 공개키인지 확인할 수 있다. 하지만, 이러한 방식은 인증기관에 확인하는 과정이 필요하므로, 인증기관과 연결되어 있어야 한다는 점과, 이 과정에서 시간이 오래 걸린다는 단점이 있다.
|
||||
|
||||
이 점을 해결하기 위해 웹 보안에서 사용하는 HTTPS에서는 TLS/SSL이라는 더 응용한 암호가 적용된다. TLS는 상호 알고리즘 교환, 키 교환과 인증, 대칭키 생성과 통신이라는 세 단계로 나누어 통신한다.
|
||||
|
||||
#### 3. ECC
|
||||
|
||||
ECC는, Elliptic Curve Cryptography로, 타원곡선 이론에 기반한 암호화 알고리즘이다. RSA에서는 소수를 사용했다면, ECC에서는 GF에서 EC연산의 비가역성을 이용한다. EC는 RSA보다 키의 길이가 짧아도 보안성이 우수하며, 연산 시간이 더 짧다는 장점이 있어, 블록체인이나 IoT 보안 등 현재의 암호에는 ECC가 주로 사용된다.
|
||||
|
||||
타원곡선이란 무엇일까? 타원곡선이란, _ y2=x3+Ax+B_ 의 형식으로 나타나는 음함수이다. 타원곡선은 타원의 둘레를 계산하기 위해 타원을 적분하려다 나타난 식이라고 하는데, 그 함수의 역함수가 위의 형식이라고 한다. 더 자세하게 말하면, 체 k에서, 타원곡선은 특정 조건들을 만족시키며 원점이 주어진 k에 대한 사영 대수 곡선이다. 첫번째 특이점을 가지지 않으며, 둘째 위상수학적으로 원환면이며, 셋째 적어도 하나의 유리점을 가진다는 조건이다. 하나하나씩 알아보자.
|
||||
|
||||
체는 무엇이고, 사영 대수 곡선이란 말은 어떤 말일까?
|
||||
|
||||
일단 체(Field)란, 사칙연산(덧셈, 뺄셈, 곱셈, 나눗셈)에 대해 닫혀있는 집합을 의미한다. 이는 하나의 체 안에 있는 원소들끼리 사칙연산을 해도 그 값이 체 안에 속해있다는 의미이다. 가장 대표적인 체는 유리수 집합, 실수 집합, 복소수 집합이 있다.
|
||||
|
||||
즉, 체 k에서 특정한 조건을 만족시키며 특정 원점을 가지는 대수 곡선이라는 의미는, 위에서 언급했던 타원 방정식을 만족시키면서 A, B로 표기되어 있는 계수가 하나로 정해져 있는 점들의 집합을 의미한다. 타원 곡선이 체라고 하는 이유는, 타원 곡선에서 새롭게 정의한 덧셈을 이용해 서로 다른 점끼리 덧셈을 하면, 타원곡선 위에 있기 때문에, 사칙연산에 대해 닫혀있기 때문이다. 타원 곡선을 어떤 체 위에서 정의하느냐에 따라 달라지겠지만, 암호학에서 사용할 때에는 정수 위에서 정의하는 것으로 하자. 정수는 체가 아닌데요?라는 의문을 가진다면, 정수의 나눗셈을 해결할 수 있는, 모듈러 연산을 이용한 갈루아체 위에서 정의한다고 알아두자, 이는 나중에 설명하겠다. 타원 곡선상의 덧셈의 특징을 설명하기 전에, 무한점 O에 대해 설명하겠다. 무한점 O는 말 그대로 타원곡선 상에서 무한대로 극한을 보냈을 때의 점을 의미한다. 무한점은 타원곡선 상의 점A에 대해 (앞으로 점 A라고 하면 타원곡선 위에 있는 점을 의미한다.) A+O=A를 만족시킨다. 따라서, 타원곡선 체에 대해서 무한점O는 항등원이다. 또한, 점P와 점Q에 대해서 P+Q=O를 만족시키는 점 Q는 점P에 대한 역원이고, Q=-P로 표현할 수 있겠다. 이때, -P는 P를 x축 대칭한 점이 된다. 또한 교환법칙도 성립한다. 뭐라해도 타원곡선은 체이니까 말이다.
|
||||
|
||||
그렇다면 타원곡선 위에서 덧셈을 정의하자. 덧셈을 정의하면 곱셈이나 뺼셈이 정의되고, 그렇면 나눗셈도 정의된다. 점P를 (P_x, P_y)라 하고 마찬가지로 점Q를 (Q_x, Q_y)라고 하자. 특이하게도 타원곡선 상의 덧셈은 두 점이 같은 경우와 다른 경우를 나누어서 정의하는데, 그래도 쓰면 무한점이 나오기 떄문이다.
|
||||
|
||||
If P=Q, P+Q = 2*P
|
||||
|
||||
If P!=Q, P+Q = (,)
|
||||
|
||||
이 연산을 타원연산의 덧셈으로 정의한다. 곱셈은 덧셈을 여러 번 하면 되고, 나눗셈은 갈루아 체에서 정의되는 대로 역모듈러 연산을 사용한다.
|
||||
|
||||
타원 곡선 암호는 RSA에서 소인수분해의 난해성을 이용한 것 처럼 타원곡선에서 갈루아 소수가 커질 경우 x값을 만족시키는 y의 값을 찾기 힘든 점을 이용한다. 갈루아 소수란, 갈루아 체에서 이용하는 소수로, 모듈러 상수를 의미한다.
|
||||
|
||||
ECC는 RSA와 다르게 개인키를 먼저 생성한다. 갈루아 소수 P를 상호에 정하고, 송신자는 P보다 작은 한 소수 k를 임의로 정한다. 후에, 생성자라고 불리우는 상호 동일한 타원곡서 상의 임의의 점 G에 대해 k*G를 연산하면 그 값이 공개키 Q가 된다. k*G는 계산하기 쉬운 반면에 갈루아 체에서는 G와 Q를 이용해 k를 구하기 어렵다는 점을 이용한다.
|
||||
|
||||
ECC는 RSA에 비해 반절정도로 작은 키로 같은 보안을 얻어낼 수 있다. 하지만, ECC도 취약한 부분이 존재하는데, 임의의 소수를 정하는 데에 그것이 있다. 만약 그 난수를 구하는 알고리즘이 유출된다면 ECC는 무용지물이 되기 때문이다. 실제로, ECDSA를 이용하는 서명 체계에서 난수 생성 알고리즘이 알려져 무용지물 된 사건이 있었다. 따라서, 현재는 밀러-라빈 후보와 오일러 판정법을 이용하여 임의의 소수를 도출하거나, 하드웨어적으로 블랙박스안에 넣는 방식으로 이를 방지한다.
|
||||
|
||||
ECC에서 사용하는 타원 곡선의 종류에 따라 암호화 알고리즘을 나눈다. 비트코인에서 주로 사용하는 것으로 유명한 secp256k1 곡선도 있고, 생성자와 갈루아 소수를 정해놓지 않고 이것도 임의의 t로 교환하는 방식으로 이것에서 보안을 더 높인 SECP256R1 곡선을 이용한 암호도 있다. P256은 256비트짜리 소수를 이용한다는 의미이고, k는 곡선 y^2 = x^3 + 7을 의미, r은 random을 의미한다.
|
||||
|
||||
ECC는 개인키, 공개키 발급 방식 중 하나이고, DH과 ECC를 엮어서 만든 암호화 방식이 ECDH이며, ECC와 서명 알고리즘을 엮은 것이 ECDSA이다.
|
||||
|
||||
|
||||
### **블록 암호화 알고리즘. (Block Cipher Algorithms)**
|
||||
|
||||
#### 1. DES (Data Encryption Standard)
|
||||
|
||||
DES는 64비트 블록을 사용하는 대칭키 블록 암호 알고리즘이다. 암호화 과정은 16 라운드의 Feistel 구조를 기반으로 한다. 각 라운드에서는 데이터는 48비트 서브키(subkey)를 사용하여 변형된다.
|
||||
|
||||
Key Schedule Algorithm:
|
||||
- 초기 64비트 키에서 parity check bits를 제외해 56비트로 압축한다.
|
||||
- 압축된 키는 28비트로 두 개의 반으로 나뉜다. $( C_0, D_0 )$
|
||||
- 각 라운드마다 $C_i$와 $D_i$는 라운드에 따라 정해진 수만큼 왼쪽으로 이동(rotated)한다.
|
||||
- 회전 후의 $C_i$와 $D_i$는 결합되어 56비트가 되고, 48비트 서브키를 생성하기 위해 압축 퍼뮤테이션이 적용된다.
|
||||
|
||||
Encryption Operation:
|
||||
- 초기 평문은 Initial Permutation (IP)을 통해 재배치된다.
|
||||
- 재배치된 평문은 32비트의 두 부분인 $L_0$과 $R_0$으로 나뉜다.
|
||||
- 각 라운드에서 $L_{i+1} = R_i$과 $R_{i+1} = L_i \oplus f(R_i, K_i)$를 계산한다. 여기서 $\oplus$는 bitwise XOR 연산자이고, $f$는 Feistel function, $K_i$는 $i$번째 라운드의 서브키다.
|
||||
- 마지막 라운드 후, 결과는 $R_{16}L_{16}$ 순서로 조합되고 Final Permutation (FP)을 통해 최종 암호문을 생성한다.
|
||||
|
||||
Feistel Function:
|
||||
- $f(R_i, K_i)$는 확장 퍼뮤테이션으로 시작하여 $R_i$를 48비트로 확장한다.
|
||||
- 확장된 $R_i$는 서브키 $K_i$와 XOR 연산된다.
|
||||
- 결과는 S-box lookup table을 통해 각각 6비트가 4비트로 변환된다.
|
||||
- S-box 변환 후 32비트 나온 결과에 비선형 변환이 P-box permutation으로 수행된다.
|
||||
|
||||
DES의 보안은 같은 키를 사용해서 여러 데이터를 암호화하는 경우와 56비트 키 길이가 가지는 제한된 키 공간 때문에 줄어들었다.
|
||||
|
||||
#### 2. AES (Advanced Encryption Standard)
|
||||
|
||||
AES는 128, 192, 혹은 256비트 키를 사용하여 128비트 데이터 블록을 암호화한다. AES의 구조는 Rijndael 암호에 기초를 두고 있으며, 라운드 수는 키 길이에 따라 달라진다 (10, 12, 또는 14 라운드).
|
||||
|
||||
Key Expansion:
|
||||
- 라운드 키 생성에 사용되는 Rijndael 키 스케줄은 $W[i-1]$ 에 비선형 변환과 상수의 XOR 연산을 적용하여 $W[i]$ 를 생성한다.
|
||||
- 라운드 상수는 $RC[j]$로 표현되며, 이는 $x$의 멱도로 구성된다. $x$는 갈루아 체 $GF(2^8)$의 생성원이다.
|
||||
|
||||
$$
|
||||
W[i] = W[i-Nk] \oplus \text{SubWord}(W[i-1]) \oplus RC[j]
|
||||
$$
|
||||
|
||||
여기서 $Nk$ 는 키 길이에 따른 워드 수 (4, 6, 또는 8), $RC[j]$ 는 라운드 상수, $\text{SubWord}()$ 는 S-box 변환을 적용한 함수이다.
|
||||
|
||||
Encryption Process:
|
||||
- 평문은 AddRoundKey 스텝을 통해 초기 라운드 키와 XOR 연산된다.
|
||||
- 각 중간 라운드에서는 SubBytes (byte 치환), ShiftRows (행 이동), MixColumns (열 혼합), AddRoundKey (라운드 키 가산) 연산이 순차적으로 수행된다.
|
||||
- 마지막 라운드에서는 MixColumns 스텝이 생략된다.
|
||||
|
||||
SubBytes:
|
||||
- 비선형 S-box 변환은 각 바이트를 갈루아 체 $GF(2^8)$ 의 역원을 구한 후, 아핀 변환을 적용하여 새로운 바이트로 치환한다.
|
||||
|
||||
$$
|
||||
\text{SubBytes}(a) = \text{Affine}(\text{MultiplicativeInverse}(a))
|
||||
$$
|
||||
|
||||
ShiftRows:
|
||||
- 행 별 이동은 사이클릭 퍼뮤테이션을 적용하여 암호화 과정에 확산성을 부여한다.
|
||||
|
||||
MixColumns:
|
||||
- 각 열은 다음 다항식과의 $\text{mod}\ x^4 + 1$ 에서 곱셈 연산을 통해 변환된다.
|
||||
|
||||
$$
|
||||
\begin{bmatrix}
|
||||
02 & 03 & 01 & 01\\
|
||||
01 & 02 & 03 & 01\\
|
||||
01 & 01 & 02 & 03\\
|
||||
03 & 01 & 01 & 02
|
||||
\end{bmatrix}
|
||||
\cdot
|
||||
\begin{bmatrix}
|
||||
b_0\\
|
||||
b_1\\
|
||||
b_2\\
|
||||
b_3
|
||||
\end{bmatrix}
|
||||
$$
|
||||
|
||||
여기서 $b_0, b_1, b_2, b_3$은 현 열의 바이트이며, 행렬 연산은 $GF(2^8)$ 상에서 수행된다.
|
||||
|
||||
AddRoundKey:
|
||||
- 각 라운드 키는 현재 상태와 다음과 같이 XOR 연산된다.
|
||||
|
||||
$$
|
||||
\text{State} \oplus \text{RoundKey}
|
||||
$$
|
||||
|
||||
AES는 모듈러 산술과 갈루아 체(Galois field)를 사용하여 비선형 및 확산적 특성을 갖는다.
|
||||
|
||||
#### 3. SEED
|
||||
|
||||
SEED는 한국 인터넷진흥원(KISA)에 의해 개발된 128비트 블록 암호 방식으로, 128비트 키를 사용하며 16 라운드의 Feistel 구조를 따른다.
|
||||
|
||||
Encryption Process:
|
||||
- 128비트 키는 16개의 64비트 서브키로 확장된다.
|
||||
- 초기 평문 블록은 키와 Feistel 네트워크를 통해 가공된다.
|
||||
- 각 라운드의 결과는 두 반으로 이뤄져 있고, 지정된 함수를 통해 연산된 다음, 키와 XOR 연산된다.
|
||||
- 키 확장 과정에서 사용되는 상수는 일련의 알고리즘을 통해 생성되며, 이는 SEED의 보안성을 향상시킨다.
|
||||
|
||||
$$
|
||||
K_i = f(K_{i-1}), \quad \text{where } i = 1, 2, \ldots, 16
|
||||
$$
|
||||
|
||||
여기서 $f()$ 는 키 확장 함수, $K_i$ 는 $i$번째 라운드의 서브키이다.
|
||||
|
||||
Feistel Function:
|
||||
- SEED의 Feistel 함수는 S-box를 통한 비선형 변환과 $GF(2^{32})$에서의 변환을 결합하여 사용한다. S-box의 비선형 특성과 더불어 선형 변환은 암호화 과정에 확산성과 혼돈성을 주입한다.
|
||||
|
||||
각 라운드에서의 연산은 다음과 같은 수학적 표현으로 이루어진다.
|
||||
|
||||
$$
|
||||
\text{left} = \text{right}
|
||||
$$
|
||||
$$
|
||||
\text{right} = \text{left} \oplus F(\text{right}, K_i)
|
||||
$$
|
||||
|
||||
여기서 $F()$ 는 Feistel 함수, $K_i$ 는 라운드 서브키이며, $\text{left}$와 $\text{right}$는 데이터 블록의 두 부분을 의미한다.
|
||||
|
||||
SEED는 높은 보안성과 우수한 성능으로 인해 South Korea 전자정부 및 인터넷 은행 거래에 사용된다.
|
||||
|
||||
#### 4. PRINCE
|
||||
|
||||
PRINCE는 저전력 환경에 최적화된 경량 블록암호로 AES와 마찬가지로 여러 개의 라운드로 구분된다. Mix Column부터 ShiftBits까지 AES와 매우 비슷하지만, 연산을 더욱 간단화하고 라운드 수를 줄여 저성능 프로세서에서도 많은 비용과 시간을 들이지 않고도 암호화, 복호화를 진행할 수 있도록 한 암호화 방식이다. 기초적인 것들은 AES와 비슷하므로 바로 암호화, 복호화 과정을 살펴보자. 여기서는 PRINCE-64/128을 기준으로 설명할 것이다. 128bit 비밀키를 이용하여 64비트 키로 분할하여 사용한다는 의미이다.
|
||||
|
||||
PRINCE의 구조는 12 라운드로 구성되며, 상호 역변환되는 라운드 함수를 사용한다.
|
||||
|
||||
Encryption/Decryption Process:
|
||||
- PRINCE 알고리즘은 암호화와 복호화 과정이 매우 유사하며, 라운드 키 스케줄이 역순으로 구성된다.
|
||||
- PRINCEcore는 중심 라운드로, 여기에서 상태는 여섯 개의 서브 라운드를 계속 거친다.
|
||||
- 암호화와 복호화는 대칭적인 알파(reflection) 구조를 갖는다. 즉, 전반부와 후반부 라운드가 서로 역변환된다.
|
||||
|
||||
Key Schedule:
|
||||
- 키 스케줄에서, 128비트 키는 두 개의 64비트 부분 키로 나뉘며, 알파 상수를 사용하여 변형된다.
|
||||
|
||||
S-box-based Nonlinear Layer:
|
||||
- PRINCE 알고리즘은 비선형성을 부여하기 위해 S-box를 사용한다.
|
||||
|
||||
M-Layer (Linear Transformation Layer):
|
||||
- 이 선형 변환층은 확산을 증대시키기 위해 사용된다.
|
||||
|
||||
위 과정을 통해서 암호화하는 알고리즘을 4-Round 알고리즘이라 하며, 표준 Prince알고리즘은 총 12-Round를 사용한다. 이처럼 연산의 용이성을 위해 라운드를 줄인 Prince를 Round-Reduced Prince라고 한다.
|
||||
PRINCE 알고리즘은 그것의 반사성(reflection property) 덕분에, 암호화 구조가 복호화 구조를 간단하게 반전시키는 방식으로 구현될 수 있다는 점에서 하드웨어 구현 시에 에너지 효율성을 높여준다. 하지만, 4-Round PRINCE-64/128 나 6-Round PRINCE-64/128는 고정키 대입 공격등 Side-Channel 공격에 면역이 없기 때문에 IoT나 소형 기기에서는 적당히 타협하여 12-Round PRINCE-64/128를 사용 한다.
|
||||
|
||||
|
||||
### **해시 알고리즘. (Hash Algorithms)**
|
||||
|
||||
#### 1. MD5 (Message-Digest Algorithm 5)
|
||||
|
||||
MD5는 512비트 메시지 블록을 다루고 128비트 해시 값을 생성한다. MD5의 구성은 다음과 같다:
|
||||
|
||||
Process:
|
||||
- 입력 메시지는 512비트 블록으로 나뉜다.
|
||||
- 각 블록은 압축 함수와 초기 해시 값(또는 이전 블록의 결과)에 의해 처리된다.
|
||||
- 압축 함수는 네 개의 사이클을 사용해서 각 블록을 처리한다.
|
||||
|
||||
Compression Function:
|
||||
- 각 사이클은 S-box와 비선형 함수를 사용하며 메시지 블록과 현재 해시 값을 기반으로 연산을 수행한다.
|
||||
- 출력은 이전 해시 상태와 더해진다.
|
||||
|
||||
MD5는 충돌 공격에 취약하기 때문에 현재 보안이 중요한 용도에는 권장하지 않는다.
|
||||
|
||||
#### 2. SHA (Secure Hash Algorithm)
|
||||
|
||||
SHA 패밀리는 다양한 해시 함수들을 포함한다 (SHA-0, SHA-1, SHA-2).
|
||||
|
||||
SHA-1 Process:
|
||||
- 메시지는 512비트 블록으로 나뉘고 블록마다 압축 함수를 사용해 160비트 해시를 계산.
|
||||
- 각 블록은 특정한 비선형 기능과 함께 반복된다.
|
||||
|
||||
SHA-2 Variants (SHA-256, SHA-512 등):
|
||||
- SHA-2는 무결성 보장 목적에 사용, 더 긴 해시 값과 변형된 알고리즘을 포함.
|
||||
- SHA-256은 32비트 워드, SHA-512는 64비트 워드를 사용한다.
|
||||
|
||||
Compression Function:
|
||||
- 체인화된 값과 야수 상수를 사용한 라운드 함수.
|
||||
- 메시지 스케줄, 라운드 상수, 라운드 함수, 중간 상태 갱신을 통한 해시 생성.
|
||||
|
||||
SHA 알고리즘들은 다양한 애플리케이션에서 널리 사용되며, 특히 SHA-256과 SHA-3은 현재 많이 사용된다.
|
||||
|
||||
#### SHA-1
|
||||
|
||||
SHA-1 해시 함수는 메시지 $ M $을 160비트의 해시 값으로 매핑한다.
|
||||
|
||||
Initialization:
|
||||
- 초기 해시 값 $ H^{(0)} $는 5개의 32비트 워드 $ H_0^{(0)}, H_1^{(0)}, H_2^{(0)}, H_3^{(0)}, H_4^{(0)} $로 설정된다.
|
||||
|
||||
Message Preprocessing:
|
||||
- 입력 메시지 $ M $은 512비트 블록들로 나누어지고, 패딩과 길이 인코딩을 거쳐 $ L $ 비트의 메시지가 된다.
|
||||
- 각 블록에 대해, 80개의 32비트 워드 $ W $로 확장된 메시지 스케줄이 생성된다.
|
||||
|
||||
Hash Computation:
|
||||
- 각 라운드 $ t $에서 다음의 연산을 수행한다:
|
||||
$$ T = (H_0 \lll 5) + f_t(H_1, H_2, H_3) + H_4 + W_t + K_t $$
|
||||
$$ H_4 = H_3 $$
|
||||
$$ H_3 = H_2 $$
|
||||
$$ H_2 = H_1 \lll 30 $$
|
||||
$$ H_1 = H_0 $$
|
||||
$$ H_0 = T $$
|
||||
여기서 $ f_t $는 라운드에 따라 변하는 논리 함수이며, $ K_t $는 라운드 상수이다.
|
||||
|
||||
#### SHA-256
|
||||
|
||||
Initialization:
|
||||
- 초기 해시 값 $ H $는 $ H_0 $부터 $ H_7 $까지의 8개의 32비트 워드로 구성되며, 이는 특정 소수의 제곱근에서 파생된다.
|
||||
|
||||
Message Preprocessing:
|
||||
- 입력 메시지 $ M $은 512비트 블록들로 나누어지며, 패딩 및 길이 인코딩을 거쳐 메시지 스케줄 $ W $로 변환된다.
|
||||
- $ W $는 64개의 32비트 워드로 확장되며, 각 $ W_t $는 $ M $의 해당 부분과 앞선 워드들의 비선형 함수 $ f $에 의해 계산된다.
|
||||
|
||||
Hash Computation:
|
||||
- 메인 루프는 $ H $를 업데이트하기 위해 64회의 라운드를 수행한다.
|
||||
- 각 $ t $번째 라운드에서, 다음과 같은 수학적 연산이 수행된다:
|
||||
$$ T_1 = H_7 + \Sigma_1(H_4) + \text{Ch}(H_4, H_5, H_6) + K_t + W_t $$
|
||||
$$ T_2 = \Sigma_0(H_0) + \text{Maj}(H_0, H_1, H_2) $$
|
||||
여기서 $ \Sigma_0, \Sigma_1 $은 각각 회전 및 오른쪽 시프트 연산으로 정의되며, $ \text{Ch} $와 $ \text{Maj} $는 입력 워드들의 비트를 선택하는 논리 함수이다.
|
||||
- 그 후, 중간 해시 값 $ H $는 다음과 같이 업데이트된다:
|
||||
$$ H_7 = H_6 $$
|
||||
$$ H_6 = H_5 $$
|
||||
$$ H_5 = H_4 $$
|
||||
$$ H_4 = H_3 + T_1 $$
|
||||
$$ H_3 = H_2 $$
|
||||
$$ H_2 = H_1 $$
|
||||
$$ H_1 = H_0 $$
|
||||
$$ H_0 = T_1 + T_2 $$
|
||||
|
||||
SHA-256의 모든 수학적 변환은 $ \text{GF}(2^{32}) $상에서 수행되며, $ K_t $는 각 라운드에 고유한 상수이다. SHA 알고리즘은 입력 메시지의 아주 작은 변화도 출력 해시 값에 큰 변화를 가져오는 "avalanche effect"를 만들어내는 설계 원리를 가지고 있다.
|
||||
|
||||
#### 3. HMAC (Hash-Based Message Authentication Code)
|
||||
|
||||
HMAC은 해시 알고리즘 위에 구축된 메시지 인증 코드 (MAC) 프로토콜이며, 키와 메시지 모두를 기반으로 한 인증 태그를 생성한다.
|
||||
|
||||
HMAC Process:
|
||||
- 키와 함께 초기화 벡터(IV)를 사용하여 해시 함수에 입력.
|
||||
- 두 단계 과정:
|
||||
- 내부 해시($H(K \oplus ipad \parallel m)$)는 입력 메시지 m과 패딩이 적용된 키 K를 사용.
|
||||
- 외부 해시($H(K \oplus opad \parallel inner)$)는 내부 해시 결과에 다시 패딩이 적용된 키 K를 사용.
|
||||
|
||||
여기에서 $ipad$, $opad$는 특정한 패딩 값을 가리키고, $H$는 해시 함수, $K$는 비밀 키, $\parallel$는 이어붙이기 연산자다.
|
||||
|
||||
- 주어진 메시지 $ M $과 비밀 키 $ K $에 대해, HMAC은 다음과 같이 계산된다:
|
||||
|
||||
$$ \text{HMAC}(K, M) = H((K' \oplus opad) \text{concat} H((K' \oplus ipad) \text{concat} M)) $$
|
||||
여기서 $ H $는 해시 함수, $ K' $는 원래 키 $ K $를 내부 블록 크기에 맞게 조정한 것, $ opad $와 $ ipad $는 각각 외부 및 내부 패딩이다.
|
||||
|
||||
HMAC은 키와 긴 메시지를 사용한 메시지 인증, 데이터 무결성, 데이터 출처 인증에 사용된다.
|
||||
883
content/archive/2021-07-10-cfd-python-navier-stokes.md
Normal file
883
content/archive/2021-07-10-cfd-python-navier-stokes.md
Normal file
@@ -0,0 +1,883 @@
|
||||
---
|
||||
date: 2021-07-10T08:23:47.000Z
|
||||
description: ""
|
||||
draft: false
|
||||
title: CFD with Python (Navier-Stokes Equation)
|
||||
aliases: ["/archive/fd-with-python-navier-stokes-equation/"]
|
||||
---
|
||||
## 1-D Linear Convection
|
||||
|
||||
1차원 선형 열전도 방정식은 가장 심플하면서도 가장 기초적인 방정식입니다.
|
||||
|
||||
$$ \frac{\partial u}{\partial t} + c \frac{\partial u}{\partial x} = 0 $$
|
||||
|
||||
이 식을 오일러 방정식으로 변환하여 수치해석적으로 해를 구할 수 있도록 변환을 해줍니다.
|
||||
|
||||
$$ u*i^{n+1} = u_i^n - c \frac{\Delta t}{\Delta x}(u_i^n-u*{i-1}^n) $$
|
||||
|
||||
이제 이 오일러 방정식을 파이썬으로 구현해봅니다.
|
||||
|
||||
```python
|
||||
import numpy
|
||||
from matplotlib import pyplot
|
||||
import time, sys
|
||||
%matplotlib inline
|
||||
|
||||
nx = 41 # try changing this number from 41 to 81 and Run All ... what happens?
|
||||
dx = 2 / (nx-1)
|
||||
nt = 25 #nt is the number of timesteps we want to calculate
|
||||
dt = .025 #dt is the amount of time each timestep covers (delta t)
|
||||
c = 1 #assume wavespeed of c = 1
|
||||
|
||||
u = numpy.ones(nx) #numpy function ones()
|
||||
u[int(.5 / dx):int(1 / dx + 1)] = 2 #setting u = 2 between 0.5 and 1 as per our I.C.s
|
||||
|
||||
un = numpy.ones(nx) #initialize a temporary array
|
||||
|
||||
for n in range(nt): #loop for values of n from 0 to nt, so it will run nt times
|
||||
un = u.copy() ##copy the existing values of u into un
|
||||
for i in range(1, nx): ## you can try commenting this line and...
|
||||
#for i in range(nx): ## ... uncommenting this line and see what happens!
|
||||
u[i] = un[i] - c * dt / dx * (un[i] - un[i-1])
|
||||
|
||||
pyplot.plot(numpy.linspace(0, 2, nx), u);
|
||||
```
|
||||
|
||||
{{< figure src="https://blog.kakaocdn.net/dn/ZbM8j/btq9fWovXzY/D1HOqkCqgkw9YLDpyMFxb1/img.png" >}}
|
||||
|
||||
## 1-D Convection Equation (Non-Linear)
|
||||
|
||||
$$ \frac{\partial u}{\partial t} + u \frac{\partial u}{\partial x} = 0 $$
|
||||
|
||||
$$ u*i^{n+1} = u_i^n - u_i^n \frac{\Delta t}{\Delta x} (u_i^n - u*{i-1}^n) $$
|
||||
|
||||
```python
|
||||
import numpy # we're importing numpy
|
||||
from matplotlib import pyplot # and our 2D plotting library
|
||||
%matplotlib inline
|
||||
|
||||
|
||||
nx = 41
|
||||
dx = 2 / (nx - 1)
|
||||
nt = 20 #nt is the number of timesteps we want to calculate
|
||||
dt = .025 #dt is the amount of time each timestep covers (delta t)
|
||||
|
||||
u = numpy.ones(nx) #as before, we initialize u with every value equal to 1.
|
||||
u[int(.5 / dx) : int(1 / dx + 1)] = 2 #then set u = 2 between 0.5 and 1 as per our I.C.s
|
||||
|
||||
un = numpy.ones(nx) #initialize our placeholder array un, to hold the time-stepped solution
|
||||
|
||||
for n in range(nt): #iterate through time
|
||||
un = u.copy() ##copy the existing values of u into un
|
||||
for i in range(1, nx): ##now we'll iterate through the u array
|
||||
|
||||
###This is the line from Step 1, copied exactly. Edit it for our new equation.
|
||||
###then uncomment it and run the cell to evaluate Step 2
|
||||
|
||||
###u[i] = un[i] - c * dt / dx * (un[i] - un[i-1])
|
||||
|
||||
|
||||
pyplot.plot(numpy.linspace(0, 2, nx), u) ##Plot the results
|
||||
```
|
||||
|
||||
## 1-D Diffusion Equation
|
||||
|
||||
$$ \frac{\partial u}{\partial t}= \nu \frac{\partial^2 u}{\partial x^2} $$
|
||||
|
||||
$$ u*{i}^{n+1}=u*{i}^{n}+\frac{\nu\Delta t}{\Delta x^2}(u*{i+1}^{n}-2u*{i}^{n}+u_{i-1}^{n}) $$
|
||||
|
||||
```python
|
||||
import numpy #loading our favorite library
|
||||
from matplotlib import pyplot #and the useful plotting library
|
||||
%matplotlib inline
|
||||
|
||||
nx = 41
|
||||
dx = 2 / (nx - 1)
|
||||
nt = 20 #the number of timesteps we want to calculate
|
||||
nu = 0.3 #the value of viscosity
|
||||
sigma = .2 #sigma is a parameter, we'll learn more about it later
|
||||
dt = sigma * dx**2 / nu #dt is defined using sigma ... more later!
|
||||
|
||||
|
||||
u = numpy.ones(nx) #a numpy array with nx elements all equal to 1.
|
||||
u[int(.5 / dx):int(1 / dx + 1)] = 2 #setting u = 2 between 0.5 and 1 as per our I.C.s
|
||||
|
||||
un = numpy.ones(nx) #our placeholder array, un, to advance the solution in time
|
||||
|
||||
for n in range(nt): #iterate through time
|
||||
un = u.copy() ##copy the existing values of u into un
|
||||
for i in range(1, nx - 1):
|
||||
u[i] = un[i] + nu * dt / dx**2 * (un[i+1] - 2 * un[i] + un[i-1])
|
||||
|
||||
pyplot.plot(numpy.linspace(0, 2, nx), u);
|
||||
```
|
||||
|
||||
{{< figure src="https://blog.kakaocdn.net/dn/oaKgN/btq9iA57vBH/weCFyYoImjFkasFiDMir3k/img.png" >}}
|
||||
|
||||
## Burger's Equation
|
||||
|
||||
$$ \frac{\partial u}{\partial t} + u \frac{\partial u}{\partial x} = \nu \frac{\partial ^2u}{\partial x^2} $$
|
||||
|
||||
$$ u*i^{n+1} = u_i^n - u_i^n \frac{\Delta t}{\Delta x} (u_i^n - u*{i-1}^n) + \nu \frac{\Delta t}{\Delta x^2}(u*{i+1}^n - 2u_i^n + u*{i-1}^n) $$
|
||||
|
||||
```python
|
||||
import numpy
|
||||
import sympy
|
||||
from sympy import init_printing
|
||||
from matplotlib import pyplot
|
||||
from sympy.utilities.lambdify import lambdify
|
||||
|
||||
%matplotlib inline
|
||||
init_printing(use_latex=True)
|
||||
|
||||
x, nu, t = sympy.symbols('x nu t')
|
||||
phi = (sympy.exp(-(x - 4 * t)**2 / (4 * nu * (t + 1))) +
|
||||
sympy.exp(-(x - 4 * t - 2 * sympy.pi)**2 / (4 * nu * (t + 1))))
|
||||
|
||||
phiprime = phi.diff(x)
|
||||
|
||||
u = -2 * nu * (phiprime / phi) + 4
|
||||
ufunc = lambdify((t, x, nu), u)
|
||||
|
||||
###variable declarations
|
||||
nx = 101
|
||||
nt = 100
|
||||
dx = 2 * numpy.pi / (nx - 1)
|
||||
nu = .07
|
||||
dt = dx * nu
|
||||
|
||||
x = numpy.linspace(0, 2 * numpy.pi, nx)
|
||||
un = numpy.empty(nx)
|
||||
t = 0
|
||||
|
||||
u = numpy.asarray([ufunc(t, x0, nu) for x0 in x])
|
||||
|
||||
for n in range(nt):
|
||||
un = u.copy()
|
||||
for i in range(1, nx-1):
|
||||
u[i] = un[i] - un[i] * dt / dx *(un[i] - un[i-1]) + nu * dt / dx**2 *\
|
||||
(un[i+1] - 2 * un[i] + un[i-1])
|
||||
u[0] = un[0] - un[0] * dt / dx * (un[0] - un[-2]) + nu * dt / dx**2 *\
|
||||
(un[1] - 2 * un[0] + un[-2])
|
||||
u[-1] = u[0]
|
||||
|
||||
u_analytical = numpy.asarray([ufunc(nt * dt, xi, nu) for xi in x])
|
||||
|
||||
pyplot.figure(figsize=(11, 7), dpi=100)
|
||||
pyplot.plot(x,u, marker='o', lw=2, label='Computational')
|
||||
pyplot.plot(x, u_analytical, label='Analytical')
|
||||
pyplot.xlim([0, 2 * numpy.pi])
|
||||
pyplot.ylim([0, 10])
|
||||
pyplot.legend();
|
||||
```
|
||||
|
||||
{{< figure src="https://blog.kakaocdn.net/dn/cE7P8B/btq9dF2BVpt/J6GbNhRT4dX1nfB2GPkurK/img.png" >}}
|
||||
|
||||
## 2-D Linear Convection
|
||||
|
||||
$$ \frac{\partial u}{\partial t}+c\frac{\partial u}{\partial x} + c\frac{\partial u}{\partial y} = 0 $$
|
||||
|
||||
$$ u*{i,j}^{n+1} = u*{i,j}^n-c \frac{\Delta t}{\Delta x}(u*{i,j}^n-u*{i-1,j}^n)-c \frac{\Delta t}{\Delta y}(u*{i,j}^n-u*{i,j-1}^n) $$
|
||||
|
||||
```python
|
||||
from mpl_toolkits.mplot3d import Axes3D ##New Library required for projected 3d plots
|
||||
|
||||
import numpy
|
||||
from matplotlib import pyplot, cm
|
||||
%matplotlib inline
|
||||
|
||||
###variable declarations
|
||||
nx = 81
|
||||
ny = 81
|
||||
nt = 100
|
||||
c = 1
|
||||
dx = 2 / (nx - 1)
|
||||
dy = 2 / (ny - 1)
|
||||
sigma = .2
|
||||
dt = sigma * dx
|
||||
|
||||
x = numpy.linspace(0, 2, nx)
|
||||
y = numpy.linspace(0, 2, ny)
|
||||
|
||||
u = numpy.ones((ny, nx)) ##create a 1xn vector of 1's
|
||||
un = numpy.ones((ny, nx)) ##
|
||||
|
||||
###Assign initial conditions
|
||||
|
||||
##set hat function I.C. : u(.5<=x<=1 && .5<=y<=1 ) is 2
|
||||
u[int(.5 / dy):int(1 / dy + 1),int(.5 / dx):int(1 / dx + 1)] = 2
|
||||
|
||||
###Plot Initial Condition
|
||||
##the figsize parameter can be used to produce different sized images
|
||||
fig = pyplot.figure(figsize=(11, 7), dpi=100)
|
||||
ax = fig.gca(projection='3d')
|
||||
X, Y = numpy.meshgrid(x, y)
|
||||
surf = ax.plot_surface(X, Y, u[:], cmap=cm.viridis)
|
||||
```
|
||||
|
||||
{{< figure src="https://blog.kakaocdn.net/dn/MH3sO/btq9fmIfvXs/Tbral2sgJxUQHfJgs1hG61/img.png" >}}
|
||||
|
||||
## 2-D Convection
|
||||
|
||||
$$ \frac{\partial u}{\partial t} + u \frac{\partial u}{\partial x} + v \frac{\partial u}{\partial y} = 0 $$$$ \frac{\partial v}{\partial t} + u \frac{\partial v}{\partial x} + v \frac{\partial v}{\partial y} = 0 $$$$ u*{i,j}^{n+1} = u*{i,j}^n - u*{i,j} \frac{\Delta t}{\Delta x} (u*{i,j}^n-u*{i-1,j}^n) - v*{i,j}^n \frac{\Delta t}{\Delta y} (u*{i,j}^n-u*{i,j-1}^n) $$$$ v*{i,j}^{n+1} = v*{i,j}^n - u*{i,j} \frac{\Delta t}{\Delta x} (v*{i,j}^n-v*{i-1,j}^n) - v*{i,j}^n \frac{\Delta t}{\Delta y} (v*{i,j}^n-v*{i,j-1}^n) $$
|
||||
|
||||
```python
|
||||
from mpl_toolkits.mplot3d import Axes3D
|
||||
from matplotlib import pyplot, cm
|
||||
import numpy
|
||||
%matplotlib inline
|
||||
|
||||
###variable declarations
|
||||
nx = 101
|
||||
ny = 101
|
||||
nt = 80
|
||||
c = 1
|
||||
dx = 2 / (nx - 1)
|
||||
dy = 2 / (ny - 1)
|
||||
sigma = .2
|
||||
dt = sigma * dx
|
||||
|
||||
x = numpy.linspace(0, 2, nx)
|
||||
y = numpy.linspace(0, 2, ny)
|
||||
|
||||
u = numpy.ones((ny, nx)) ##create a 1xn vector of 1's
|
||||
v = numpy.ones((ny, nx))
|
||||
un = numpy.ones((ny, nx))
|
||||
vn = numpy.ones((ny, nx))
|
||||
|
||||
###Assign initial conditions
|
||||
##set hat function I.C. : u(.5<=x<=1 && .5<=y<=1 ) is 2
|
||||
u[int(.5 / dy):int(1 / dy + 1), int(.5 / dx):int(1 / dx + 1)] = 2
|
||||
##set hat function I.C. : v(.5<=x<=1 && .5<=y<=1 ) is 2
|
||||
v[int(.5 / dy):int(1 / dy + 1), int(.5 / dx):int(1 / dx + 1)] = 2
|
||||
fig = pyplot.figure(figsize=(11, 7), dpi=100)
|
||||
ax = fig.gca(projection='3d')
|
||||
X, Y = numpy.meshgrid(x, y)
|
||||
|
||||
ax.plot_surface(X, Y, u, cmap=cm.viridis, rstride=2, cstride=2)
|
||||
ax.set_xlabel('$x$')
|
||||
ax.set_ylabel('$y$');
|
||||
```
|
||||
|
||||
{{< figure src="https://blog.kakaocdn.net/dn/bbiKmO/btq9hyAHR99/3KeBvxXPvCzXXYqrTlSj9k/img.png" >}}
|
||||
|
||||
## 2D Diffusion
|
||||
|
||||
$$ \frac{\partial u}{\partial t} = \nu \frac{\partial ^2 u}{\partial x^2} + \nu \frac{\partial ^2 u}{\partial y^2} $$$$ \begin{split}u*{i,j}^{n+1} = u*{i,j}^n &+ \frac{\nu \Delta t}{\Delta x^2}(u*{i+1,j}^n - 2 u*{i,j}^n + u*{i-1,j}^n) \&+ \frac{\nu \Delta t}{\Delta y^2}(u*{i,j+1}^n-2 u*{i,j}^n + u*{i,j-1}^n)\end{split} $$
|
||||
|
||||
```python
|
||||
import numpy
|
||||
from matplotlib import pyplot, cm
|
||||
from mpl_toolkits.mplot3d import Axes3D ##library for 3d projection plots
|
||||
%matplotlib inline
|
||||
###variable declarations
|
||||
nx = 31
|
||||
ny = 31
|
||||
nt = 17
|
||||
nu = .05
|
||||
dx = 2 / (nx - 1)
|
||||
dy = 2 / (ny - 1)
|
||||
sigma = .25
|
||||
dt = sigma * dx * dy / nu
|
||||
|
||||
x = numpy.linspace(0, 2, nx)
|
||||
y = numpy.linspace(0, 2, ny)
|
||||
|
||||
u = numpy.ones((ny, nx)) # create a 1xn vector of 1's
|
||||
un = numpy.ones((ny, nx))
|
||||
|
||||
###Assign initial conditions
|
||||
# set hat function I.C. : u(.5<=x<=1 && .5<=y<=1 ) is 2
|
||||
u[int(.5 / dy):int(1 / dy + 1),int(.5 / dx):int(1 / dx + 1)] = 2
|
||||
|
||||
###Run through nt timesteps
|
||||
def diffuse(nt):
|
||||
u[int(.5 / dy):int(1 / dy + 1),int(.5 / dx):int(1 / dx + 1)] = 2
|
||||
|
||||
for n in range(nt + 1):
|
||||
un = u.copy()
|
||||
u[1:-1, 1:-1] = (un[1:-1,1:-1] +
|
||||
nu * dt / dx**2 *
|
||||
(un[1:-1, 2:] - 2 * un[1:-1, 1:-1] + un[1:-1, 0:-2]) +
|
||||
nu * dt / dy**2 *
|
||||
(un[2:,1: -1] - 2 * un[1:-1, 1:-1] + un[0:-2, 1:-1]))
|
||||
u[0, :] = 1
|
||||
u[-1, :] = 1
|
||||
u[:, 0] = 1
|
||||
u[:, -1] = 1
|
||||
|
||||
|
||||
fig = pyplot.figure()
|
||||
ax = fig.gca(projection='3d')
|
||||
surf = ax.plot_surface(X, Y, u[:], rstride=1, cstride=1, cmap=cm.viridis,
|
||||
linewidth=0, antialiased=True)
|
||||
ax.set_zlim(1, 2.5)
|
||||
ax.set_xlabel('$x$')
|
||||
ax.set_ylabel('$y$');
|
||||
|
||||
diffuse(14)
|
||||
```
|
||||
|
||||
{{< figure src="https://blog.kakaocdn.net/dn/eLwQEW/btq9e0ysgnx/YVHruuNPlMa6pJODaIGJdK/img.png" >}}
|
||||
|
||||
## Burgers' Equation in 2D
|
||||
|
||||
$$ \frac{\partial u}{\partial t} + u \frac{\partial u}{\partial x} + v \frac{\partial u}{\partial y} = \nu ; \left(\frac{\partial ^2 u}{\partial x^2} + \frac{\partial ^2 u}{\partial y^2}\right) $$$$ \frac{\partial v}{\partial t} + u \frac{\partial v}{\partial x} + v \frac{\partial v}{\partial y} = \nu ; \left(\frac{\partial ^2 v}{\partial x^2} + \frac{\partial ^2 v}{\partial y^2}\right) $$$$ \begin{split}v*{i,j}^{n+1} = & v*{i,j}^n - \frac{\Delta t}{\Delta x} u*{i,j}^n (v*{i,j}^n - v*{i-1,j}^n) - \frac{\Delta t}{\Delta y} v*{i,j}^n (v*{i,j}^n - v*{i,j-1}^n) \&+ \frac{\nu \Delta t}{\Delta x^2}(v*{i+1,j}^n-2v*{i,j}^n+v*{i-1,j}^n) + \frac{\nu \Delta t}{\Delta y^2} (v*{i,j+1}^n - 2v*{i,j}^n + v*{i,j-1}^n)\end{split} $$
|
||||
|
||||
```python
|
||||
import numpy
|
||||
from matplotlib import pyplot, cm
|
||||
from mpl_toolkits.mplot3d import Axes3D
|
||||
%matplotlib inline
|
||||
###variable declarations
|
||||
nx = 41
|
||||
ny = 41
|
||||
nt = 120
|
||||
c = 1
|
||||
dx = 2 / (nx - 1)
|
||||
dy = 2 / (ny - 1)
|
||||
sigma = .0009
|
||||
nu = 0.01
|
||||
dt = sigma * dx * dy / nu
|
||||
|
||||
|
||||
x = numpy.linspace(0, 2, nx)
|
||||
y = numpy.linspace(0, 2, ny)
|
||||
|
||||
u = numpy.ones((ny, nx)) # create a 1xn vector of 1's
|
||||
v = numpy.ones((ny, nx))
|
||||
un = numpy.ones((ny, nx))
|
||||
vn = numpy.ones((ny, nx))
|
||||
comb = numpy.ones((ny, nx))
|
||||
|
||||
###Assign initial conditions
|
||||
|
||||
##set hat function I.C. : u(.5<=x<=1 && .5<=y<=1 ) is 2
|
||||
u[int(.5 / dy):int(1 / dy + 1),int(.5 / dx):int(1 / dx + 1)] = 2
|
||||
##set hat function I.C. : u(.5<=x<=1 && .5<=y<=1 ) is 2
|
||||
v[int(.5 / dy):int(1 / dy + 1),int(.5 / dx):int(1 / dx + 1)] = 2
|
||||
###(plot ICs)
|
||||
for n in range(nt + 1): ##loop across number of time steps
|
||||
un = u.copy()
|
||||
vn = v.copy()
|
||||
|
||||
u[1:-1, 1:-1] = (un[1:-1, 1:-1] -
|
||||
dt / dx * un[1:-1, 1:-1] *
|
||||
(un[1:-1, 1:-1] - un[1:-1, 0:-2]) -
|
||||
dt / dy * vn[1:-1, 1:-1] *
|
||||
(un[1:-1, 1:-1] - un[0:-2, 1:-1]) +
|
||||
nu * dt / dx**2 *
|
||||
(un[1:-1,2:] - 2 * un[1:-1, 1:-1] + un[1:-1, 0:-2]) +
|
||||
nu * dt / dy**2 *
|
||||
(un[2:, 1:-1] - 2 * un[1:-1, 1:-1] + un[0:-2, 1:-1]))
|
||||
|
||||
v[1:-1, 1:-1] = (vn[1:-1, 1:-1] -
|
||||
dt / dx * un[1:-1, 1:-1] *
|
||||
(vn[1:-1, 1:-1] - vn[1:-1, 0:-2]) -
|
||||
dt / dy * vn[1:-1, 1:-1] *
|
||||
(vn[1:-1, 1:-1] - vn[0:-2, 1:-1]) +
|
||||
nu * dt / dx**2 *
|
||||
(vn[1:-1, 2:] - 2 * vn[1:-1, 1:-1] + vn[1:-1, 0:-2]) +
|
||||
nu * dt / dy**2 *
|
||||
(vn[2:, 1:-1] - 2 * vn[1:-1, 1:-1] + vn[0:-2, 1:-1]))
|
||||
|
||||
u[0, :] = 1
|
||||
u[-1, :] = 1
|
||||
u[:, 0] = 1
|
||||
u[:, -1] = 1
|
||||
|
||||
v[0, :] = 1
|
||||
v[-1, :] = 1
|
||||
v[:, 0] = 1
|
||||
v[:, -1] = 1
|
||||
fig = pyplot.figure(figsize=(11, 7), dpi=100)
|
||||
ax = fig.gca(projection='3d')
|
||||
X, Y = numpy.meshgrid(x, y)
|
||||
ax.plot_surface(X, Y, u, cmap=cm.viridis, rstride=1, cstride=1)
|
||||
ax.plot_surface(X, Y, v, cmap=cm.viridis, rstride=1, cstride=1)
|
||||
ax.set_xlabel('$x$')
|
||||
ax.set_ylabel('$y$');
|
||||
```
|
||||
|
||||
{{< figure src="https://blog.kakaocdn.net/dn/PL2CD/btq9fcyC1VV/MC1B8I2YedaaCFr5Lr06KK/img.png" >}}
|
||||
|
||||
## 2D Laplace Equation
|
||||
|
||||
$$ \frac{\partial ^2 p}{\partial x^2} + \frac{\partial ^2 p}{\partial y^2} = 0 $$$$ p*{i,j}^n = \frac{\Delta y^2(p*{i+1,j}^n+p*{i-1,j}^n)+\Delta x^2(p*{i,j+1}^n + p_{i,j-1}^n)}{2(\Delta x^2 + \Delta y^2)} $$
|
||||
|
||||
```python
|
||||
import numpy
|
||||
from matplotlib import pyplot, cm
|
||||
from mpl_toolkits.mplot3d import Axes3D
|
||||
%matplotlib inline
|
||||
|
||||
def plot2D(x, y, p):
|
||||
fig = pyplot.figure(figsize=(11, 7), dpi=100)
|
||||
ax = fig.gca(projection='3d')
|
||||
X, Y = numpy.meshgrid(x, y)
|
||||
surf = ax.plot_surface(X, Y, p[:], rstride=1, cstride=1, cmap=cm.viridis,
|
||||
linewidth=0, antialiased=False)
|
||||
ax.set_xlim(0, 2)
|
||||
ax.set_ylim(0, 1)
|
||||
ax.view_init(30, 225)
|
||||
ax.set_xlabel('$x$')
|
||||
ax.set_ylabel('$y$')
|
||||
|
||||
def laplace2d(p, y, dx, dy, l1norm_target):
|
||||
l1norm = 1
|
||||
pn = numpy.empty_like(p)
|
||||
|
||||
while l1norm > l1norm_target:
|
||||
pn = p.copy()
|
||||
p[1:-1, 1:-1] = ((dy**2 * (pn[1:-1, 2:] + pn[1:-1, 0:-2]) +
|
||||
dx**2 * (pn[2:, 1:-1] + pn[0:-2, 1:-1])) /
|
||||
(2 * (dx**2 + dy**2)))
|
||||
|
||||
p[:, 0] = 0 # p = 0 @ x = 0
|
||||
p[:, -1] = y # p = y @ x = 2
|
||||
p[0, :] = p[1, :] # dp/dy = 0 @ y = 0
|
||||
p[-1, :] = p[-2, :] # dp/dy = 0 @ y = 1
|
||||
l1norm = (numpy.sum(numpy.abs(p[:]) - numpy.abs(pn[:])) /
|
||||
numpy.sum(numpy.abs(pn[:])))
|
||||
|
||||
return p
|
||||
|
||||
nx = 31
|
||||
ny = 31
|
||||
c = 1
|
||||
dx = 2 / (nx - 1)
|
||||
dy = 2 / (ny - 1)
|
||||
|
||||
|
||||
##initial conditions
|
||||
p = numpy.zeros((ny, nx)) # create a XxY vector of 0's
|
||||
|
||||
|
||||
##plotting aids
|
||||
x = numpy.linspace(0, 2, nx)
|
||||
y = numpy.linspace(0, 1, ny)
|
||||
|
||||
##boundary conditions
|
||||
p[:, 0] = 0 # p = 0 @ x = 0
|
||||
p[:, -1] = y # p = y @ x = 2
|
||||
p[0, :] = p[1, :] # dp/dy = 0 @ y = 0
|
||||
p[-1, :] = p[-2, :] # dp/dy = 0 @ y = 1
|
||||
|
||||
p = laplace2d(p, y, dx, dy, 1e-4)
|
||||
|
||||
plot2D(x, y, p)
|
||||
```
|
||||
|
||||
{{< figure src="https://blog.kakaocdn.net/dn/bxvdGX/btq9goyjEC1/YkjgRDKkIZuAe2isKNsv60/img.png" >}}
|
||||
|
||||
## 2D Poisson Equation
|
||||
|
||||
$$ \frac{\partial ^2 p}{\partial x^2} + \frac{\partial ^2 p}{\partial y^2} = b $$$$ p*{i,j}^{n}=\frac{(p*{i+1,j}^{n}+p*{i-1,j}^{n})\Delta y^2+(p*{i,j+1}^{n}+p*{i,j-1}^{n})\Delta x^2-b*{i,j}^{n}\Delta x^2\Delta y^2}{2(\Delta x^2+\Delta y^2)} $$
|
||||
|
||||
```python
|
||||
import numpy
|
||||
from matplotlib import pyplot, cm
|
||||
from mpl_toolkits.mplot3d import Axes3D
|
||||
%matplotlib inline
|
||||
# Parameters
|
||||
nx = 50
|
||||
ny = 50
|
||||
nt = 100
|
||||
xmin = 0
|
||||
xmax = 2
|
||||
ymin = 0
|
||||
ymax = 1
|
||||
|
||||
dx = (xmax - xmin) / (nx - 1)
|
||||
dy = (ymax - ymin) / (ny - 1)
|
||||
|
||||
# Initialization
|
||||
p = numpy.zeros((ny, nx))
|
||||
pd = numpy.zeros((ny, nx))
|
||||
b = numpy.zeros((ny, nx))
|
||||
x = numpy.linspace(xmin, xmax, nx)
|
||||
y = numpy.linspace(xmin, xmax, ny)
|
||||
|
||||
# Source
|
||||
b[int(ny / 4), int(nx / 4)] = 100
|
||||
b[int(3 * ny / 4), int(3 * nx / 4)] = -100
|
||||
|
||||
for it in range(nt):
|
||||
|
||||
pd = p.copy()
|
||||
|
||||
p[1:-1,1:-1] = (((pd[1:-1, 2:] + pd[1:-1, :-2]) * dy**2 +
|
||||
(pd[2:, 1:-1] + pd[:-2, 1:-1]) * dx**2 -
|
||||
b[1:-1, 1:-1] * dx**2 * dy**2) /
|
||||
(2 * (dx**2 + dy**2)))
|
||||
|
||||
p[0, :] = 0
|
||||
p[ny-1, :] = 0
|
||||
p[:, 0] = 0
|
||||
p[:, nx-1] = 0
|
||||
|
||||
def plot2D(x, y, p):
|
||||
fig = pyplot.figure(figsize=(11, 7), dpi=100)
|
||||
ax = fig.gca(projection='3d')
|
||||
X, Y = numpy.meshgrid(x, y)
|
||||
surf = ax.plot_surface(X, Y, p[:], rstride=1, cstride=1, cmap=cm.viridis,
|
||||
linewidth=0, antialiased=False)
|
||||
ax.view_init(30, 225)
|
||||
ax.set_xlabel('$x$')
|
||||
ax.set_ylabel('$y$')
|
||||
|
||||
plot2D(x, y, p)
|
||||
```
|
||||
|
||||
## Cavity Flow with Navier–Stokes
|
||||
|
||||
$$ \frac{\partial \vec{v}}{\partial t}+(\vec{v}\cdot\nabla)\vec{v}=-\frac{1}{\rho}\nabla p + \nu \nabla^2\vec{v} $$$$ \frac{\partial u}{\partial t}+u\frac{\partial u}{\partial x}+v\frac{\partial u}{\partial y} = -\frac{1}{\rho}\frac{\partial p}{\partial x}+\nu \left(\frac{\partial^2 u}{\partial x^2}+\frac{\partial^2 u}{\partial y^2} \right) $$$$ \frac{\partial^2 p}{\partial x^2}+\frac{\partial^2 p}{\partial y^2} = -\rho\left(\frac{\partial u}{\partial x}\frac{\partial u}{\partial x}+2\frac{\partial u}{\partial y}\frac{\partial v}{\partial x}+\frac{\partial v}{\partial y}\frac{\partial v}{\partial y} \right) $$$$ \begin{split}p*{i,j}^{n} = & \frac{\left(p*{i+1,j}^{n}+p*{i-1,j}^{n}\right) \Delta y^2 + \left(p*{i,j+1}^{n}+p*{i,j-1}^{n}\right) \Delta x^2}{2\left(\Delta x^2+\Delta y^2\right)} \& -\frac{\rho\Delta x^2\Delta y^2}{2\left(\Delta x^2+\Delta y^2\right)} \& \times \left[\frac{1}{\Delta t}\left(\frac{u*{i+1,j}-u*{i-1,j}}{2\Delta x}+\frac{v*{i,j+1}-v*{i,j-1}}{2\Delta y}\right)-\frac{u*{i+1,j}-u*{i-1,j}}{2\Delta x}\frac{u*{i+1,j}-u*{i-1,j}}{2\Delta x} -2\frac{u*{i,j+1}-u*{i,j-1}}{2\Delta y}\frac{v*{i+1,j}-v*{i-1,j}}{2\Delta x}-\frac{v*{i,j+1}-v*{i,j-1}}{2\Delta y}\frac{v*{i,j+1}-v_{i,j-1}}{2\Delta y}\right]\end{split} $$
|
||||
|
||||
```python
|
||||
import numpy
|
||||
from matplotlib import pyplot, cm
|
||||
from mpl_toolkits.mplot3d import Axes3D
|
||||
%matplotlib inline
|
||||
nx = 41
|
||||
ny = 41
|
||||
nt = 500
|
||||
nit = 50
|
||||
c = 1
|
||||
dx = 2 / (nx - 1)
|
||||
dy = 2 / (ny - 1)
|
||||
x = numpy.linspace(0, 2, nx)
|
||||
y = numpy.linspace(0, 2, ny)
|
||||
X, Y = numpy.meshgrid(x, y)
|
||||
|
||||
rho = 1
|
||||
nu = .1
|
||||
dt = .001
|
||||
|
||||
u = numpy.zeros((ny, nx))
|
||||
v = numpy.zeros((ny, nx))
|
||||
p = numpy.zeros((ny, nx))
|
||||
b = numpy.zeros((ny, nx))
|
||||
|
||||
def build_up_b(b, rho, dt, u, v, dx, dy):
|
||||
|
||||
b[1:-1, 1:-1] = (rho * (1 / dt *
|
||||
((u[1:-1, 2:] - u[1:-1, 0:-2]) /
|
||||
(2 * dx) + (v[2:, 1:-1] - v[0:-2, 1:-1]) / (2 * dy)) -
|
||||
((u[1:-1, 2:] - u[1:-1, 0:-2]) / (2 * dx))**2 -
|
||||
2 * ((u[2:, 1:-1] - u[0:-2, 1:-1]) / (2 * dy) *
|
||||
(v[1:-1, 2:] - v[1:-1, 0:-2]) / (2 * dx))-
|
||||
((v[2:, 1:-1] - v[0:-2, 1:-1]) / (2 * dy))**2))
|
||||
|
||||
return b
|
||||
|
||||
def pressure_poisson(p, dx, dy, b):
|
||||
pn = numpy.empty_like(p)
|
||||
pn = p.copy()
|
||||
|
||||
for q in range(nit):
|
||||
pn = p.copy()
|
||||
p[1:-1, 1:-1] = (((pn[1:-1, 2:] + pn[1:-1, 0:-2]) * dy**2 +
|
||||
(pn[2:, 1:-1] + pn[0:-2, 1:-1]) * dx**2) /
|
||||
(2 * (dx**2 + dy**2)) -
|
||||
dx**2 * dy**2 / (2 * (dx**2 + dy**2)) *
|
||||
b[1:-1,1:-1])
|
||||
|
||||
p[:, -1] = p[:, -2] # dp/dx = 0 at x = 2
|
||||
p[0, :] = p[1, :] # dp/dy = 0 at y = 0
|
||||
p[:, 0] = p[:, 1] # dp/dx = 0 at x = 0
|
||||
p[-1, :] = 0 # p = 0 at y = 2
|
||||
|
||||
return p
|
||||
|
||||
def cavity_flow(nt, u, v, dt, dx, dy, p, rho, nu):
|
||||
un = numpy.empty_like(u)
|
||||
vn = numpy.empty_like(v)
|
||||
b = numpy.zeros((ny, nx))
|
||||
|
||||
for n in range(nt):
|
||||
un = u.copy()
|
||||
vn = v.copy()
|
||||
|
||||
b = build_up_b(b, rho, dt, u, v, dx, dy)
|
||||
p = pressure_poisson(p, dx, dy, b)
|
||||
|
||||
u[1:-1, 1:-1] = (un[1:-1, 1:-1]-
|
||||
un[1:-1, 1:-1] * dt / dx *
|
||||
(un[1:-1, 1:-1] - un[1:-1, 0:-2]) -
|
||||
vn[1:-1, 1:-1] * dt / dy *
|
||||
(un[1:-1, 1:-1] - un[0:-2, 1:-1]) -
|
||||
dt / (2 * rho * dx) * (p[1:-1, 2:] - p[1:-1, 0:-2]) +
|
||||
nu * (dt / dx**2 *
|
||||
(un[1:-1, 2:] - 2 * un[1:-1, 1:-1] + un[1:-1, 0:-2]) +
|
||||
dt / dy**2 *
|
||||
(un[2:, 1:-1] - 2 * un[1:-1, 1:-1] + un[0:-2, 1:-1])))
|
||||
|
||||
v[1:-1,1:-1] = (vn[1:-1, 1:-1] -
|
||||
un[1:-1, 1:-1] * dt / dx *
|
||||
(vn[1:-1, 1:-1] - vn[1:-1, 0:-2]) -
|
||||
vn[1:-1, 1:-1] * dt / dy *
|
||||
(vn[1:-1, 1:-1] - vn[0:-2, 1:-1]) -
|
||||
dt / (2 * rho * dy) * (p[2:, 1:-1] - p[0:-2, 1:-1]) +
|
||||
nu * (dt / dx**2 *
|
||||
(vn[1:-1, 2:] - 2 * vn[1:-1, 1:-1] + vn[1:-1, 0:-2]) +
|
||||
dt / dy**2 *
|
||||
(vn[2:, 1:-1] - 2 * vn[1:-1, 1:-1] + vn[0:-2, 1:-1])))
|
||||
|
||||
u[0, :] = 0
|
||||
u[:, 0] = 0
|
||||
u[:, -1] = 0
|
||||
u[-1, :] = 1 # set velocity on cavity lid equal to 1
|
||||
v[0, :] = 0
|
||||
v[-1, :] = 0
|
||||
v[:, 0] = 0
|
||||
v[:, -1] = 0
|
||||
|
||||
|
||||
return u, v, p
|
||||
|
||||
u = numpy.zeros((ny, nx))
|
||||
v = numpy.zeros((ny, nx))
|
||||
p = numpy.zeros((ny, nx))
|
||||
b = numpy.zeros((ny, nx))
|
||||
nt = 100
|
||||
u, v, p = cavity_flow(nt, u, v, dt, dx, dy, p, rho, nu)
|
||||
fig = pyplot.figure(figsize=(11,7), dpi=100)
|
||||
# plotting the pressure field as a contour
|
||||
pyplot.contourf(X, Y, p, alpha=0.5, cmap=cm.viridis)
|
||||
pyplot.colorbar()
|
||||
# plotting the pressure field outlines
|
||||
pyplot.contour(X, Y, p, cmap=cm.viridis)
|
||||
# plotting velocity field
|
||||
pyplot.quiver(X[::2, ::2], Y[::2, ::2], u[::2, ::2], v[::2, ::2])
|
||||
pyplot.xlabel('X')
|
||||
pyplot.ylabel('Y');
|
||||
```
|
||||
|
||||
{{< figure src="https://blog.kakaocdn.net/dn/VgtZK/btq9flvNFsA/4d03urU7VcLPRqzS5g40m1/img.png" >}}
|
||||
|
||||
```python
|
||||
u = numpy.zeros((ny, nx))
|
||||
v = numpy.zeros((ny, nx))
|
||||
p = numpy.zeros((ny, nx))
|
||||
b = numpy.zeros((ny, nx))
|
||||
nt = 700
|
||||
u, v, p = cavity_flow(nt, u, v, dt, dx, dy, p, rho, nu)
|
||||
fig = pyplot.figure(figsize=(11, 7), dpi=100)
|
||||
pyplot.contourf(X, Y, p, alpha=0.5, cmap=cm.viridis)
|
||||
pyplot.colorbar()
|
||||
pyplot.contour(X, Y, p, cmap=cm.viridis)
|
||||
pyplot.quiver(X[::2, ::2], Y[::2, ::2], u[::2, ::2], v[::2, ::2])
|
||||
pyplot.xlabel('X')
|
||||
pyplot.ylabel('Y');
|
||||
```
|
||||
|
||||
{{< figure src="https://blog.kakaocdn.net/dn/boYcRB/btq9fmasDP2/6w1UPPVU4mG7frDcjQtBIK/img.png" >}}
|
||||
|
||||
```python
|
||||
fig = pyplot.figure(figsize=(11, 7), dpi=100)
|
||||
pyplot.contourf(X, Y, p, alpha=0.5, cmap=cm.viridis)
|
||||
pyplot.colorbar()
|
||||
pyplot.contour(X, Y, p, cmap=cm.viridis)
|
||||
pyplot.streamplot(X, Y, u, v)
|
||||
pyplot.xlabel('X')
|
||||
pyplot.ylabel('Y');
|
||||
```
|
||||
|
||||
{{< figure src="https://blog.kakaocdn.net/dn/0J2aJ/btq9e57PmFB/UqArsnX9hzJ84H4rW5AtB1/img.png" >}}
|
||||
|
||||
## Channel Flow with Navier–Stokes
|
||||
|
||||
$$ \frac{\partial u}{\partial t}+u\frac{\partial u}{\partial x}+v\frac{\partial u}{\partial y}=-\frac{1}{\rho}\frac{\partial p}{\partial x}+\nu\left(\frac{\partial^2 u}{\partial x^2}+\frac{\partial^2 u}{\partial y^2}\right)+F $$$$ \frac{\partial^2 p}{\partial x^2}+\frac{\partial^2 p}{\partial y^2}=-\rho\left(\frac{\partial u}{\partial x}\frac{\partial u}{\partial x}+2\frac{\partial u}{\partial y}\frac{\partial v}{\partial x}+\frac{\partial v}{\partial y}\frac{\partial v}{\partial y}\right) $$$$ \begin{split}p*{i,j}^{n} = & \frac{\left(p*{i+1,j}^{n}+p*{i-1,j}^{n}\right) \Delta y^2 + \left(p*{i,j+1}^{n}+p*{i,j-1}^{n}\right) \Delta x^2}{2(\Delta x^2+\Delta y^2)} \& -\frac{\rho\Delta x^2\Delta y^2}{2\left(\Delta x^2+\Delta y^2\right)} \& \times \left[\frac{1}{\Delta t} \left(\frac{u*{i+1,j}-u*{i-1,j}}{2\Delta x} + \frac{v*{i,j+1}-v*{i,j-1}}{2\Delta y}\right) - \frac{u*{i+1,j}-u*{i-1,j}}{2\Delta x}\frac{u*{i+1,j}-u*{i-1,j}}{2\Delta x} - 2\frac{u*{i,j+1}-u*{i,j-1}}{2\Delta y}\frac{v*{i+1,j}-v*{i-1,j}}{2\Delta x} - \frac{v*{i,j+1}-v*{i,j-1}}{2\Delta y}\frac{v*{i,j+1}-v_{i,j-1}}{2\Delta y}\right]\end{split} $$
|
||||
|
||||
```python
|
||||
import numpy
|
||||
from matplotlib import pyplot, cm
|
||||
from mpl_toolkits.mplot3d import Axes3D
|
||||
%matplotlib inline
|
||||
|
||||
def build_up_b(rho, dt, dx, dy, u, v):
|
||||
b = numpy.zeros_like(u)
|
||||
b[1:-1, 1:-1] = (rho * (1 / dt * ((u[1:-1, 2:] - u[1:-1, 0:-2]) / (2 * dx) +
|
||||
(v[2:, 1:-1] - v[0:-2, 1:-1]) / (2 * dy)) -
|
||||
((u[1:-1, 2:] - u[1:-1, 0:-2]) / (2 * dx))**2 -
|
||||
2 * ((u[2:, 1:-1] - u[0:-2, 1:-1]) / (2 * dy) *
|
||||
(v[1:-1, 2:] - v[1:-1, 0:-2]) / (2 * dx))-
|
||||
((v[2:, 1:-1] - v[0:-2, 1:-1]) / (2 * dy))**2))
|
||||
|
||||
# Periodic BC Pressure @ x = 2
|
||||
b[1:-1, -1] = (rho * (1 / dt * ((u[1:-1, 0] - u[1:-1,-2]) / (2 * dx) +
|
||||
(v[2:, -1] - v[0:-2, -1]) / (2 * dy)) -
|
||||
((u[1:-1, 0] - u[1:-1, -2]) / (2 * dx))**2 -
|
||||
2 * ((u[2:, -1] - u[0:-2, -1]) / (2 * dy) *
|
||||
(v[1:-1, 0] - v[1:-1, -2]) / (2 * dx)) -
|
||||
((v[2:, -1] - v[0:-2, -1]) / (2 * dy))**2))
|
||||
|
||||
# Periodic BC Pressure @ x = 0
|
||||
b[1:-1, 0] = (rho * (1 / dt * ((u[1:-1, 1] - u[1:-1, -1]) / (2 * dx) +
|
||||
(v[2:, 0] - v[0:-2, 0]) / (2 * dy)) -
|
||||
((u[1:-1, 1] - u[1:-1, -1]) / (2 * dx))**2 -
|
||||
2 * ((u[2:, 0] - u[0:-2, 0]) / (2 * dy) *
|
||||
(v[1:-1, 1] - v[1:-1, -1]) / (2 * dx))-
|
||||
((v[2:, 0] - v[0:-2, 0]) / (2 * dy))**2))
|
||||
|
||||
return b
|
||||
|
||||
def pressure_poisson_periodic(p, dx, dy):
|
||||
pn = numpy.empty_like(p)
|
||||
|
||||
for q in range(nit):
|
||||
pn = p.copy()
|
||||
p[1:-1, 1:-1] = (((pn[1:-1, 2:] + pn[1:-1, 0:-2]) * dy**2 +
|
||||
(pn[2:, 1:-1] + pn[0:-2, 1:-1]) * dx**2) /
|
||||
(2 * (dx**2 + dy**2)) -
|
||||
dx**2 * dy**2 / (2 * (dx**2 + dy**2)) * b[1:-1, 1:-1])
|
||||
|
||||
# Periodic BC Pressure @ x = 2
|
||||
p[1:-1, -1] = (((pn[1:-1, 0] + pn[1:-1, -2])* dy**2 +
|
||||
(pn[2:, -1] + pn[0:-2, -1]) * dx**2) /
|
||||
(2 * (dx**2 + dy**2)) -
|
||||
dx**2 * dy**2 / (2 * (dx**2 + dy**2)) * b[1:-1, -1])
|
||||
|
||||
# Periodic BC Pressure @ x = 0
|
||||
p[1:-1, 0] = (((pn[1:-1, 1] + pn[1:-1, -1])* dy**2 +
|
||||
(pn[2:, 0] + pn[0:-2, 0]) * dx**2) /
|
||||
(2 * (dx**2 + dy**2)) -
|
||||
dx**2 * dy**2 / (2 * (dx**2 + dy**2)) * b[1:-1, 0])
|
||||
|
||||
# Wall boundary conditions, pressure
|
||||
p[-1, :] =p[-2, :] # dp/dy = 0 at y = 2
|
||||
p[0, :] = p[1, :] # dp/dy = 0 at y = 0
|
||||
|
||||
return p
|
||||
|
||||
##variable declarations
|
||||
nx = 41
|
||||
ny = 41
|
||||
nt = 10
|
||||
nit = 50
|
||||
c = 1
|
||||
dx = 2 / (nx - 1)
|
||||
dy = 2 / (ny - 1)
|
||||
x = numpy.linspace(0, 2, nx)
|
||||
y = numpy.linspace(0, 2, ny)
|
||||
X, Y = numpy.meshgrid(x, y)
|
||||
|
||||
|
||||
##physical variables
|
||||
rho = 1
|
||||
nu = .1
|
||||
F = 1
|
||||
dt = .01
|
||||
|
||||
#initial conditions
|
||||
u = numpy.zeros((ny, nx))
|
||||
un = numpy.zeros((ny, nx))
|
||||
|
||||
v = numpy.zeros((ny, nx))
|
||||
vn = numpy.zeros((ny, nx))
|
||||
|
||||
p = numpy.ones((ny, nx))
|
||||
pn = numpy.ones((ny, nx))
|
||||
|
||||
b = numpy.zeros((ny, nx))
|
||||
|
||||
udiff = 1
|
||||
stepcount = 0
|
||||
|
||||
while udiff > .001:
|
||||
un = u.copy()
|
||||
vn = v.copy()
|
||||
|
||||
b = build_up_b(rho, dt, dx, dy, u, v)
|
||||
p = pressure_poisson_periodic(p, dx, dy)
|
||||
|
||||
u[1:-1, 1:-1] = (un[1:-1, 1:-1] -
|
||||
un[1:-1, 1:-1] * dt / dx *
|
||||
(un[1:-1, 1:-1] - un[1:-1, 0:-2]) -
|
||||
vn[1:-1, 1:-1] * dt / dy *
|
||||
(un[1:-1, 1:-1] - un[0:-2, 1:-1]) -
|
||||
dt / (2 * rho * dx) *
|
||||
(p[1:-1, 2:] - p[1:-1, 0:-2]) +
|
||||
nu * (dt / dx**2 *
|
||||
(un[1:-1, 2:] - 2 * un[1:-1, 1:-1] + un[1:-1, 0:-2]) +
|
||||
dt / dy**2 *
|
||||
(un[2:, 1:-1] - 2 * un[1:-1, 1:-1] + un[0:-2, 1:-1])) +
|
||||
F * dt)
|
||||
|
||||
v[1:-1, 1:-1] = (vn[1:-1, 1:-1] -
|
||||
un[1:-1, 1:-1] * dt / dx *
|
||||
(vn[1:-1, 1:-1] - vn[1:-1, 0:-2]) -
|
||||
vn[1:-1, 1:-1] * dt / dy *
|
||||
(vn[1:-1, 1:-1] - vn[0:-2, 1:-1]) -
|
||||
dt / (2 * rho * dy) *
|
||||
(p[2:, 1:-1] - p[0:-2, 1:-1]) +
|
||||
nu * (dt / dx**2 *
|
||||
(vn[1:-1, 2:] - 2 * vn[1:-1, 1:-1] + vn[1:-1, 0:-2]) +
|
||||
dt / dy**2 *
|
||||
(vn[2:, 1:-1] - 2 * vn[1:-1, 1:-1] + vn[0:-2, 1:-1])))
|
||||
|
||||
# Periodic BC u @ x = 2
|
||||
u[1:-1, -1] = (un[1:-1, -1] - un[1:-1, -1] * dt / dx *
|
||||
(un[1:-1, -1] - un[1:-1, -2]) -
|
||||
vn[1:-1, -1] * dt / dy *
|
||||
(un[1:-1, -1] - un[0:-2, -1]) -
|
||||
dt / (2 * rho * dx) *
|
||||
(p[1:-1, 0] - p[1:-1, -2]) +
|
||||
nu * (dt / dx**2 *
|
||||
(un[1:-1, 0] - 2 * un[1:-1,-1] + un[1:-1, -2]) +
|
||||
dt / dy**2 *
|
||||
(un[2:, -1] - 2 * un[1:-1, -1] + un[0:-2, -1])) + F * dt)
|
||||
|
||||
# Periodic BC u @ x = 0
|
||||
u[1:-1, 0] = (un[1:-1, 0] - un[1:-1, 0] * dt / dx *
|
||||
(un[1:-1, 0] - un[1:-1, -1]) -
|
||||
vn[1:-1, 0] * dt / dy *
|
||||
(un[1:-1, 0] - un[0:-2, 0]) -
|
||||
dt / (2 * rho * dx) *
|
||||
(p[1:-1, 1] - p[1:-1, -1]) +
|
||||
nu * (dt / dx**2 *
|
||||
(un[1:-1, 1] - 2 * un[1:-1, 0] + un[1:-1, -1]) +
|
||||
dt / dy**2 *
|
||||
(un[2:, 0] - 2 * un[1:-1, 0] + un[0:-2, 0])) + F * dt)
|
||||
|
||||
# Periodic BC v @ x = 2
|
||||
v[1:-1, -1] = (vn[1:-1, -1] - un[1:-1, -1] * dt / dx *
|
||||
(vn[1:-1, -1] - vn[1:-1, -2]) -
|
||||
vn[1:-1, -1] * dt / dy *
|
||||
(vn[1:-1, -1] - vn[0:-2, -1]) -
|
||||
dt / (2 * rho * dy) *
|
||||
(p[2:, -1] - p[0:-2, -1]) +
|
||||
nu * (dt / dx**2 *
|
||||
(vn[1:-1, 0] - 2 * vn[1:-1, -1] + vn[1:-1, -2]) +
|
||||
dt / dy**2 *
|
||||
(vn[2:, -1] - 2 * vn[1:-1, -1] + vn[0:-2, -1])))
|
||||
|
||||
# Periodic BC v @ x = 0
|
||||
v[1:-1, 0] = (vn[1:-1, 0] - un[1:-1, 0] * dt / dx *
|
||||
(vn[1:-1, 0] - vn[1:-1, -1]) -
|
||||
vn[1:-1, 0] * dt / dy *
|
||||
(vn[1:-1, 0] - vn[0:-2, 0]) -
|
||||
dt / (2 * rho * dy) *
|
||||
(p[2:, 0] - p[0:-2, 0]) +
|
||||
nu * (dt / dx**2 *
|
||||
(vn[1:-1, 1] - 2 * vn[1:-1, 0] + vn[1:-1, -1]) +
|
||||
dt / dy**2 *
|
||||
(vn[2:, 0] - 2 * vn[1:-1, 0] + vn[0:-2, 0])))
|
||||
|
||||
|
||||
# Wall BC: u,v = 0 @ y = 0,2
|
||||
u[0, :] = 0
|
||||
u[-1, :] = 0
|
||||
v[0, :] = 0
|
||||
v[-1, :]=0
|
||||
|
||||
udiff = (numpy.sum(u) - numpy.sum(un)) / numpy.sum(u)
|
||||
stepcount += 1
|
||||
|
||||
fig = pyplot.figure(figsize = (11,7), dpi=100)
|
||||
pyplot.quiver(X[::3, ::3], Y[::3, ::3], u[::3, ::3], v[::3, ::3]);
|
||||
```
|
||||
|
||||
{{< figure src="https://blog.kakaocdn.net/dn/du6hla/btq9fdKZP6o/ifKi67Tsr8khMmReNSHn5K/img.png" >}}
|
||||
|
||||
출처> [CFD Python: 12 steps to Navier-Stokes :: Lorena A. Barba Group (lorenabarba.com)](https://lorenabarba.com/blog/cfd-python-12-steps-to-navier-stokes/)
|
||||
69
content/archive/2021-08-06-hardware-security.md
Normal file
69
content/archive/2021-08-06-hardware-security.md
Normal file
@@ -0,0 +1,69 @@
|
||||
+++
|
||||
date = 2021-08-06T10:31:09Z
|
||||
description = ""
|
||||
draft = false
|
||||
title = "Hardware Security"
|
||||
|
||||
+++
|
||||
|
||||
|
||||
## Hardware Security
|
||||
|
||||
### **신뢰성과 관련된 기술**
|
||||
|
||||
#### 1. RoT (Root of Trust)
|
||||
|
||||
Root of Trust, 신뢰점이란, 전자기기 안에서 별도로 존재하는 프로세싱 유닛으로, 메인 프로세서의 보조로서 다양한 암호화 기법이나 솔루션을 제공하거나 이를 제어하기 위한 보안 기능들을 의미한다. RoT가 궁극적으로 달성하고자 하는 것은 TC(Trusted Computing)으로, 신뢰할 수 있는 컴퓨팅, 즉 믿을 만 하고 무결성이 보장되는 계산 및 기능을 이야기한다. 이를 달성하기 위한, RoT에 포함되는 여러가지 기술들이나 알고리즘이 있고, 각 단계들을 순차적으로 달성되어 신뢰할 수 있는 보안적인 프로세스가 진행된다. RoT의 대표적인 기법이나 기기는 TPF, TEE등 신뢰할 수 있는 플랫폼 모듈이나 신뢰할 수 있는 실행 환경이 있다.
|
||||
|
||||
#### 2. TPF
|
||||
|
||||
TPF, Trusted Platform Module이란, 신뢰할 수 있는 플랫폼 모듈을 의미한다. 어떤 어플리케이션이나 프로세스가 신뢰성 있도록 실행되기 위해 별도의 플랫폼 모듈을 설치한다. 이 플랫폼은 다양한 암호화 기법을 제공한다. TPF는 외부에서 접근이 불가하도록 설계된 암호화 키와 저장공간 및 연산장치를 별도로 제공함으로써 외부에서는 암호화 키나 암호화 과정 및 알고리즘, 그 설계를 알 수 없도록 만들어져 소프트웨어적으로 취약할 수 밖에 없는 키 유출을 해결한 장치/기술이다. TPF는 내부 키(서명)이 존재하고, 이를 바탕으로 다양한 암호화 프로세스를 제공한다. RSA암호화나 ECC암호화 및 서명 및 검증을 제공하며, Hashing이나 HMAC, 어플리케이션이 응용할 수 있는 암호화된 저장공간을 제공하기도 한다.
|
||||
|
||||
TPF는 외부에서는 절대 접근할 수 없게 만들어져 있다. 하드웨어적으로 메인 프로세스와 분리되어 있어 해킹 당하거나 키가 탈취당할 확률이 적으며, 별도의 메모리를 사용한다. 하지만, TPF도 물리적인 해킹에는 취약할 수 밖에 없으며, 직접 칩을 탈취하여 역공학이나 부채널 공격을 시행하면 키가 탈취당할 위험이 있다.
|
||||
|
||||
#### 3. TEE
|
||||
|
||||
TEE, Trusted Execution Environment란 신뢰할 수 있는 실행 환경을 의미한다. TPF를 따로 설치할 수 없는 환경이거나 TPF를 설치한 환경이라도 더욱 보안을 강화하기 위해 메인 프로세서를 보안 영역과 일반 사용자 영역으로 나누어 사용하는 것을 의미한다. 보안 영역에서는 TPF에서와 마찬가지로 보안 정보의 저장과 처리를 수행하고, 암호화 프로세스를 실행한다. 일반 사용자 영역에서는 보안 프로세스가 필요하면, 이를 보안 영역에서 실행함으로써 이를 신뢰 가능한 별도의 환경에서 실행하도록 하는 기술이다. 결제 및 인증 과정이나 DRM 과정이 TEE에서 주로 실행된다. 보안영역은 일반영역과 물리적으로 분리되어 있어, TPF와 마찬가지로 일반영역에서 TEE에 접근할 수 있는 방법은 TEE가 제공하는 방법밖에 없다. TEE는 TPF와는 다르게 일반 영역에 있던 잡다한 프로세스도 실행하고 처리할 수 있다. TPF에서는 비밀번호 입력 등의 온전히 메인 프로세스의 일인 것들을 처리할 수 없었지만, TEE는 메인 프로세서에 포함되어 있으므로 이러한 사소한 것들까지 모두 담당할 수 있어 보안을 더욱 향상시켜 준다. 완전히 신뢰 가능한 환경을 조성하기 위해서는 TEE와 TPF를 혼용하여 TPF는 TEE에게만 통신하고, TEE는 기타 사소한 것들까지 처리한다면 최고수준의 보안을 유지할 수 있다.
|
||||
|
||||
대표적으로는 삼성전자에서 자사 휴대폰에 기본적으로 탑재하는 보안 솔루션 Knox가 있다. Knox는 휴대폰의 CPU를 보안 영역과 일반 영역으로 나누어 TEE를 제공한다.
|
||||
|
||||
### **Side-Channel Attack 대책**
|
||||
|
||||
#### 1. Side-Channel Attack
|
||||
|
||||
Side-Channel Attack, 부채널 공격이란, 암호화 과정이나 보안 프로세스가 진행중일 때 프로세서에서 부가적으로 얻을 수 있는 다양한 정보들을 이용하여 구조를 파악하거나 키를 탈취하는 방법이다. 부가적으로 얻을 수 있는 정보는 칩에서 나오는 열이나 전자기파, 연산이 수행되는 시간, 전력 소비량, 에러 처리(Fault)등이 있다.
|
||||
|
||||
#### 2. 방어 기술
|
||||
|
||||
Side-Channel Attack의 방어에는 Hiding과 Masking기법이 가장 많이 사용된다. 마스킹이란, 연산의 중간에 사용되는 값을 랜덤하게 결함으로써 원래의 연산에서 사용되는 값들의 입력값과 연산값과의 관계를 불명확하게 하여 특성키 공격이나 알려진 평문 공격에 대비할 수 있도록 하며, 전력 사용량의 규칙성을 모호하게 만든다. 마스킹의 어떤 과정에서 랜덤한 값을 사용하는지에 따라 다양한 마스킹 기법이 존재한다. 하지만, 랜덤 알고리즘이 밝혀지거나 역공학을 통해 알아낸다면, 혹은 또 다른 공격에서는 이 방법은 효과적이지 않을 수 있다. 랜덤 알고리즘이 밝혀졌을 때의 문제점은 거의 모든 암호화 알고리즘에서의 문제이다.
|
||||
|
||||
SABL, WDDL, t-private Logic등이 있다.
|
||||
|
||||
EM(Electro-Magnetic) SCA의 대비하는 방법으로는 랜덤한 전자기파를 방출하는 방법이 있다. 암호화 퍼리 과정에서 더미 연산과 불필요한 값들을 중간중간에 넣어줌으로써 더미 전가지파를 만들어 낼 수 있다. 하지만, 결국 주요한 연산의 전자기파는 모두 누출되는 것이기에 칩을 설계할 시에 이를 대비할 방법을 모색하여 전자파를 최대한 약하게 방출하도록 하거나 차폐 솔루션을 도입하는 등의 과정이 필요하다.
|
||||
|
||||
Fault Injection SCA의 경우에는 예측 불가능한 다양한 상황에 대해서 많은 가능성을 두고 Fault처리를 할 수밖에 없다. 하지만, 이는 많은 연산 성능 하락을 유발하며, 알고리즘을 매우 무겁게 할 수 있다.
|
||||
|
||||
Timing SCA의 경우에는 각각의 입력에 대해 연산시간이 모두 동일하게 처리되도록 설계하거나, 각각의 연산에 더미 타임을 넣는 방법이 있다.
|
||||
|
||||
### **Reversing 대책**
|
||||
|
||||
#### 1. 역공학
|
||||
|
||||
역공학(Reversing)이란, 소프트웨어에서는 특정한 프로세스가 처리되는 과정에서 데이터 흐름이나 역어셈블, CPU처리 분석을 통해 원래의 알고리즘을 알아내거나 원리를 알아내어 크래킹하는 과정을 의미한다. 한편, 하드웨어의 경우에는 다양한 칩을 뜯어내어 그 구조를 확인하거나 전류 흐름을 측정하는 등의 물리적인 분석을 통해 반도체의 구조를 알아내거나 연산 중 어떤 데이터가 어떤 흐름을 통해 이동하는지에 대해 알아내는 것을 의미한다. 반도체 칩의 사진을 찍어 현미경을 통해 분석하는 과정등을 통해 데이터의 이동 버스(BUS)를 알아내는 과정이 포함된다.
|
||||
|
||||
칩의 리버싱은 디캡슐레이션, 디레이어링, 게이트 레벨 넷리스트 추출등의 과정이 있다. 먼저 패키지에선 다이를 제거하고, IC를 디캡슐레이션하여 반도체 칩에 직접 접근할 수 있도록 한다. 후에, 디레이어링을 통해 각각을 싱글 레이어로 분리하여 분석하는데, 이때에는 SEM촬영을 통하여 얻은 사진 설계도를 얻어내는 과정이 있고, 후에 이 사진을 이용하여 이를 회로도로 변환하는 과정이 있다.
|
||||
|
||||
데이터 BUS를 알아내게 된다면, 연산 중간중간에 사용되는 값들을 알 수 있으며, 입력과 출력값을 비교하여 어떤 부위가 어떤 연산을 처리하는지 알 수 있고, 이를 통해 전자기파 주입 공격을 하거나, 키를 알아낼 수 있다. 또한, 같은 역할을 하는 칩을 제작하여 이를 공격하는데 사용될 수 있다.
|
||||
|
||||
#### 2. 메모리 추출 방지
|
||||
|
||||
메모리가 유출되는 경우를 방어하기 위한 방법으로는 PUF가 있다. PUF는 Physically Unclonable Function으로, 물리적으로 복제가 불가능한 함수를 의미한다. PUF는 칩이 각각의 고유한 값을 가지도록 하며, 이를 예측 불가능하도록 하여 칩에 직접 접근해도 이를 알 수 없도록 한다.
|
||||
|
||||
#### 3. 역공학 대책
|
||||
|
||||
Reversing에 대비하는 방안에는 메모리 유출 방지에서 사용했던 방법을 사용한다. PUF를 이용함으로써 각각의 칩에 따라 연산값이 달라지게 되고, 따라서 칩의 구조를 알아내거나 Bus를 분석할 수 있어도 PUF에서의 값은 Bus를 지나가지 않으므로 키를 알 수 없다.
|
||||
|
||||
**UART? PSA?**
|
||||
|
||||
**출처> Wikipedia, [ 하드웨어 칩 기반 보안시스템 밒 해킹 동향, 한양대학교 ]**
|
||||
|
||||
32
content/archive/2021-08-06-quantum-computing-annealing.md
Normal file
32
content/archive/2021-08-06-quantum-computing-annealing.md
Normal file
@@ -0,0 +1,32 @@
|
||||
+++
|
||||
date = 2021-08-06T10:36:03Z
|
||||
description = ""
|
||||
draft = false
|
||||
aliases = ["/archive/yangja-keompyuteowa-yangja-eonilring/"]
|
||||
title = "양자 컴퓨터와 양자 어닐링"
|
||||
|
||||
+++
|
||||
|
||||
|
||||
## 양자 컴퓨터와 양자 어닐링
|
||||
|
||||
양자 컴퓨터 입문 / 양자 컴퓨팅 발전과 전망 / 1억배 빠른 양자 컴퓨터가 온다 / 스콧 애론슨의 양자 컴퓨터 강의
|
||||
|
||||
### **양자 컴퓨터란 무엇일까?**
|
||||
|
||||
#### Ø 현대 컴퓨터의 발전 과정
|
||||
|
||||
20세기, 컴퓨터(Computer)란 말은 계산하는 사람, Computing Person이라는 뜻으로 사용되었다. 하지만 단순 반복 행동을 굳이 사람이 하지 않아도 되는, 일명 계산기계가 사용될 수 있음이 증명되면서, Computer라는 말은 ‘일정한 규칙ㅇㄹ 가지고 주어진 값을 토대로 계산하는 장치’라는 의미를 가지게 되었다.
|
||||
|
||||
현대적인 컴퓨터의 정의를 시작한 사람은 ‘찰스 배비지’이다. 이 사람은 19세기 초, 차분 기관이라는 기계식 계산기를 제작한다. 그 후, 그는 더 복잡한 기관인 분석 기관(해석 기관)을 제작한다. 찰스 배비지는 차분기관을 설계하였지만, 실제 완성하지는 못하였다. 하지만 후에 실제 만들어 보면서 작동하는 것을 확인하였다. 그는 천문 테이블을 만들기 위해 이 기계를 제작하였는데, 차분 기계는 다항함수를 계산할 수 있는 기관이었다. 그는 이 기관을 설계하고 난 뒤, 해석기관을 설계하였는데, 이는 천공카드를 이용해서 범용적인 계산을 할 수 있도록 하였다. 이 기계장치도 예산이랑 시간이 부족해서 완성하지 못하였다. 하지만 한 부인이 이 컴퓨터로 실제 프로그래밍을 하며, 최초의 프로그래머로 불리우고 있다.
|
||||
|
||||
범용 컴퓨터의 현대적인 개념은 그 유명한 앨런 튜링이 정립했다. 그는 튜링 머신이라는 수학적 모델을 만들었는데, 모든 컴퓨터들은 이러한 튜링 머신을 기본 기능으로 설명할 수 있다. 그 전에 발명되었던, 현대의 트랜지스터와 같은 원리로 움직이는 진공관을 통해 튜링 머신이라는 논리적 모델을 실제 구현하게 된다. 그 후 에니그마를 깨기 위해 실제 계산 가능한 장치를 만들면서 최초의 전자식 계산기라고 알려져 있다.
|
||||
|
||||
그 후 ENIAC이 만들어 지고, 폰 노이만이 노이만 구조라는 현대까지 아직도 적용되고 있는 방식을 제안한다. 이 폰 노이만 구조란 것은, 프로그램과 데이터를 기억장치에 저장하고, 명령어를 하나씩 수행하며 데이터를 수정해 나가는 방식을 의미한다.
|
||||
|
||||
그 후 우리가 나는 집적회로와 트랜지스터가 사용되어 더욱 작은 컴퓨터가 만들어 지게 되었고, 이들이 발전해 나가면서 최초의 개인용 컴퓨터가 IBM에서 나오게 된다.
|
||||
|
||||
#### Ø 그래서, 양자 컴퓨터란 무엇인가?
|
||||
|
||||
흔히 알려진 양자 컴퓨터의 특징을 나열하자면, 0과 1 이분적이지 않게 두가지 정보를 동시에 가질 수 있고, 또 일반적인 컴퓨터보다 훨씬 빠르게 작동하고, 현대의 보안이 모두 뚫릴 것이며, 완전한 인공지능이 가능할 것이라 한다. 이중에서 물론 실제로 가능할 것도 있지만, 이런 것들이 가능하기에는 너무 오래 걸린다.
|
||||
|
||||
27
content/archive/2021-08-06-security-of-iot.md
Normal file
27
content/archive/2021-08-06-security-of-iot.md
Normal file
@@ -0,0 +1,27 @@
|
||||
---
|
||||
date: 2021-08-06T10:32:57.000Z
|
||||
description: ""
|
||||
draft: false
|
||||
title: Security of IoT
|
||||
tags:
|
||||
- security
|
||||
---
|
||||
|
||||
|
||||
## Security of IoT
|
||||
|
||||
### **IoT란?**
|
||||
|
||||
IoT (Internet of Things)란, 독립적으로 존재했던 각종 전자기기 및 사물들이 인터넷으로 엮여 한번에 관리할 수 있게 되거나 상호 정보교환과 데이터 수집을 통해 사용자에게 최상의 서비스를 제공하는 기술을 의미이다. 여기에서 사물이라 함은 전구부터 세탁기, 그리고 신발이나 의류까지 모든 사물을 포함한다. 데이터를 분석하는 과정에서 인공지능을 주로 사용하므로 IoT에는 인공지능 기술이 들어가기도 한다.
|
||||
|
||||
IoT는 2013년부터 쭉 개발되어 왔으며 집에서 흔히 볼 수 있는 에어컨, 냉장고등 큰 가구들부터 연결되어 왔다. 그 이후 시간이 지나면서 점점 작은 기구들까지 연결되면서, TV, 전자레인지, 오븐부터 커피포트, 선풍기, 전등 뿐 아니라 변기, 샤워기, 거울, 헤어 드라이기까지 연결되어 있지 않은 것이 없을 정도로 발전되어 왔다.
|
||||
|
||||
IoT 서비스 제공자들은 사용자들의 데이터를 분석하는 더욱 발전한 알고리즘을 개발하면서 사용자들의 데이터를 수집한다. 이것들은 모여 방대한 빅 데이터가 된다. 물론 고객의 개인정보 무단수집과 남용의 논란도 계속 이어져 왔지만, 서비스를 이용하기 위해서 어쩔 수 없이 개인정보와 사생활을 팔아야 하는 것은 안타까운 일이다.
|
||||
|
||||
### **IoT 보안**
|
||||
|
||||
IoT에서는 보안이 매우 중요하다. 개인의 사생활을 담당하고 있기도 하지만, 생활 환경을 조절할 수 있어 자칫하면 목숨까지 위협할 수 있기 떄문이다. IoT기기는 소형화되어 있으며 저성능으로 구성되고 하드웨어에 자체에 접근이 쉬워 해킹에 매우 취약하다. 자동화된 생산에서 만약 반도체 설계부터 문제가 있거나 펌웨어에 백도어나 트로이 목마가 존재한다면 매우 심각하고 영구적인 보안 결함이 될 것이다. 따라서, 반도체 설계, 생산 과정에서 모듈 점검을 정확하게 진행하여야 하며, 점대점(Point-to-Point) 보안을 확립하는 것이 중요하다. 또한, 저성능 프로세서에 대비하기 위해 주변에 보안칩(암호 Co-Processor)를 장치하는 것이 좋다. 소프트웨어 적인 보안은 업데이트하기 용이하고 대처하기 쉽다는 장점이 있지만, 하드웨어 보안을 확립한다면 물리적 보안, 암호 알고리즘, 보안 부팅, 키 암호화, 모듈 서명 등 다양한 보안 기능과 해킹 방지를 탑재할 수 있어 이를 확립하는 것이 무엇보다 중요하다.
|
||||
|
||||
반도체 물리적 복제 방지 (PUF)나 보안 칩(TPF)등의 탑재가 가장 중요할 것이며, 이는 키가 소프트웨어적으로 탈취당할 확률을 기하급수적으로 낮춰준다. 또한 Side-Channel Attack에 대한 방어까지 탐재하는 것이 좋을 것이다.
|
||||
|
||||
...
|
||||
20
content/archive/2021-10-23-second-failure.md
Normal file
20
content/archive/2021-10-23-second-failure.md
Normal file
@@ -0,0 +1,20 @@
|
||||
+++
|
||||
date = 2021-10-23T08:52:59Z
|
||||
description = ""
|
||||
draft = false
|
||||
aliases = ["/archive/insaeng-dubeonjjae-silpae/"]
|
||||
title = "인생 두번째 실패. 두번째 대학탈락."
|
||||
|
||||
+++
|
||||
|
||||
|
||||
내 첫번째 실패는 조기진학 실패이다. 대학을 떨어졌다.
|
||||
|
||||
내 두번째 실패도 대학 탈락이다. 이번엔 아직 9번 더 있지만, 작년에 떨어지고 느꼈던 그 참담함과 그 마음가짐을 다시 한번 느낄 수 있게 한 그 세글자 '불합격'. 역시 이번에도 참담함을 느꼈고, 여전히 안타까움과 공허함을 느낄 수 있었다.
|
||||
|
||||
내심 기대했었다. 붙기를 간절히 기도했다. 하지만 세상은 냉정했다.
|
||||
|
||||
바라던게 이제는 이룰 수 없다고 생각하니 공허했다. 하지만 그것도 잠깐이었다. 멘탈이 강하고 회복력도 강한게 내 장점이라 공허함으로 쳐져있는 것도 잠깐이었고, 앞으로를 다시 생각하고 마음가짐을 고치는 계기가 되었다.
|
||||
|
||||
할 수 있는 모든 것을 해보자. 후회없이.
|
||||
|
||||
20
content/archive/2021-10-30-ad-tech-statistics.md
Normal file
20
content/archive/2021-10-30-ad-tech-statistics.md
Normal file
@@ -0,0 +1,20 @@
|
||||
+++
|
||||
date = 2021-10-30T07:10:34Z
|
||||
description = ""
|
||||
draft = false
|
||||
aliases = ["/archive/ad-techwa-tonggyeyi-sseuimsae/"]
|
||||
title = "Ad-Tech와 통계의 쓰임새"
|
||||
|
||||
+++
|
||||
|
||||
|
||||
CTR(클릭률) Click-through rate)는 특정 링크를 클릭한 사용자의 비율. Z지수는 표준점수로, 통계학적인 정규분포를 만들고 각각의 경우가 표준편차상의 어떤 위치를 차지하는지를 보여주는 차원없는 수치이다. Z-지수는 원수치가 평균에서 얼마나 떨어져 있는지를 나타내는 지수로, $ z = \frac{z - \mu}{\sigma} $로 나타난다. ($\sigma$ 표준편차, $\mu$는 모집단의 평균이다.
|
||||
|
||||
중심극한정리란 표본의 크기가 커질수록 표본 평균의 분포는 모집단의 분포 모양과는 관계없이 정규분표에 가까워진다는 정리이다.
|
||||
|
||||
점추정은 모집단의 특성을 단일한 값으로 추정하는 방법으로, 표본평균과 표본분산을 이용해 모집단의 평균과 분산을 계산해 내는 방법이 대표적인 예이다. 평소에 신뢰구간 95%와 같이 구간추정하는 것과는 달리 적률방법을 이용하여 하나의 수치로 나타낸다. 표본분산의 기댓값이 모분산이 되고, 표본평균이 모평균이 된다. 더욱 정확한 수치를 계산하기 위해서 적률법을 이용한다. 모집단의 평균이 표본평균과 일치하는 모수를 찾는 방법으로 진행한다. 적률 생성함수는 $M_x(t) = E(e^tX)$로 표현되어 확률분포의 적률은 $ E(X^n) = M_x^(n) (0)$으로 표현할 수 있다. 적률생성함수를 몇번 미분하냐에 따라 n차 적률이라고 한다.
|
||||
|
||||
이제 Ad-Tech에서 사용하는 각종 광고 비용계산과 그 지수 산출을 알아본다.
|
||||
|
||||
CTR은 노출수 대 클릭수 비율로 구할 수 있다. 일반적으로 계산한 CTR수치는 CTR의 표본 평균이라고 할 수 있다. CTR수치는 매일마다 다르고, 또 언제 어떻게 바뀔지 모르는 랜덤 모집단이기 때문이다. 따라서, 오랜 기간동안 CTR수치를 측정하여 예측을 하는 방법으로 신뢰구간을 얻을 수 있다. 하지만, 오랜기간동안 광고수치를 계산하여 그 비용을 지불하기에는 오랜 기간이 걸리며 유행이 빠른 광고의 특성상 정확하지 않을 가능성이 있다. 따라서, 광고에서 CTR을 계산하여 캠페인의 대표 수치를 구하기 위해 표본에서 모집단의 수치를 계산할 수 있도록 중심극한 정리를 가정 하에 점추정을 통해 캠페인의 대표 CTR수치를 나타낸다.
|
||||
|
||||
21
content/archive/2021-10-30-google-pagerank-algorithm.md
Normal file
21
content/archive/2021-10-30-google-pagerank-algorithm.md
Normal file
@@ -0,0 +1,21 @@
|
||||
---
|
||||
date: 2021-10-30T07:07:55.000Z
|
||||
description: ""
|
||||
draft: false
|
||||
title: 구글 페이지랭크 알고리즘
|
||||
aliases: ["/archive/google-pagerank-algoruthm/"]
|
||||
---
|
||||
|
||||
|
||||
구글은 방대한 웹페이지를 자사 데이터베이스에 기록하고 있으며, 이를 토대로 사용자가 검색한 검색결과와 가장 매치되는 페이지를 보여줌으로써 검색엔진의 역할을 할 수 있다. 구글이 이렇게까지 클 수 있었던 이유는 정확한 검색 결과를 보여주는 알고리즘 덕분이다. 그렇다면 이 알고리즘은 무엇일까? 구글이 웹페이지들의 관계를 산출하고 그 수치를 계산해내는 알고리즘인 페이지랭크 알고리즘은 구글의 창시자중 한명인 래리 페이지라는 사람이 석사논문으로 발명한 알고리즘이다. PageRank 알고리즘은 각각의 웹 페이지의 상대적 가중치를 계산하여 각각의 중요도와 연관성을 표현하는 방식을 이용하는데, 이를 이용하여 한 페이지와 가장 연관된 다른 페이지를 Rank를 매겨 정확한 연관성을 보여줄 수 있다. PageRank에서는 각각의 웹페이지를 노드로 보고, 상호 참조와 인용으로 각각의 노드를 연결하여 하나의 거대한그래프를 만든다. 각각의 페이지는 랭크값이라는 고유한 수치를 가지고 있고, 그 페이지에서 인용된 각각의 페이지는 인용한 페이지의 랭크값을 동등하게 나눠가진다. 많이 인용된 페이지는 랭크값이 높을 것이고 적게 인용된 페이지는 랭크값이 낮을 것이므로 이 랭크값으로 페이지들의 중요도를 줄세울 수 있다. 하지만 다중연결 그래프에서 각각의 노드가 각각의 노드의 값을 참조하기 때문에 순환참조 구조가 되어 무한적으로 계산하게 되는 문제가 있고, 결과적으로 노드의 값을 계산할 수 없다는 문제가 있다. 페이지랭크 알고리즘에서는 이 각각의 페이지의 랭크값이 계산을 계속하다 보면 각각 하나의 값으로 수렴한다는 것을 증명하여 문제를 해결하였다. 아니, 애초에 문제가 되지 않았던 것이다. 이 과정에서 그래프의 각 노드 랭크값을 표현한 행렬에 변환연산을 함으로써 계산의 단계를 나아가는데, 이때 이용되는 마르코프 행렬을 구글행렬이라고 한다. 페이지랭크 알고리즘은 이러한 각각의 랭크값을 계산하는 정규화공식과 계산과정의 규칙성, 그리고 수렴한다는 증명으로 완성된다. 물론 산출 과정중에 초기 산출 방법과 루프의 해결 그리고 보정을 위한 서퍼가 존재한다.
|
||||
|
||||
**(Step1) 초기화**각 노드들의 중요도 초기값은 1N1N으로 설정.(이때 NN은 전체 웹페이지의 개수)
|
||||
|
||||
**(Step2) 업데이트**노드 K의 t번째 시도에서 중요도를 $PR(K;t)$ 라고 할때, $ PR(K;t+1)$ 은 $ PR(K;t+1) = \frac{1−d}{N} + d \Sigma{P∈K} \frac{PR(P;t)}{|Γ_P|} $ 이다. 여기서 $d(0≤d≤1)$는 제동(damping)계수이고, $Γ_K$는 K에서 인용한 노드들의 집합이다. 그리고 $|ΓP|$는 P를 인용한 노드의 개수이다.
|
||||
|
||||
구글행렬은 행렬분리를 하기 좋은 구조로 이루어져 있으며 이 덕분에 반복연산을 행하기에 매우 좋은 구조로 되어있다. 그래프를 인접행렬로 표현한 후, 각각의 페이지값을 확률행렬로 나타낸다. 인접행렬을 n승하면 n번 순회하여 도달하는 페이지를 의미한다. 하지만 인접행렬로 계산하면 수렴성을 보장할 수 없기 때문에 수렴성의 확보를 위해 확률행렬로 변환한 후, 각 열의 합이 1이 되고 나서 n승 계산을 수행한다. 따라서 행렬 S는 다음과 같이 정의한다. $S = H + \frac{1e^T}{N}$ N은 총 노드의 갯수, 벡터 1인 전체 1인 열벡터이고, e는 특정 열의 합이 0이면 원소값이 1인 열벡터이다.
|
||||
|
||||
이제 이 확률행렬을 수렴하게 계산하기 위해 구글행렬 G를 계산한다.
|
||||
|
||||
$G = dS + (1-d)E$이고, 이때 d는 Damping 계수이다. 이렇게 계산한 구글행렬을 페이지랭크 알고리즘에 대입하면 가장 큰 고윳값이 1인 행렬이 되어 Frobenius 정리에 의해 초기값에 관계없이 일정한 값으로 수렴한다.
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
+++
|
||||
date = 2021-10-30T07:09:53Z
|
||||
description = ""
|
||||
draft = false
|
||||
aliases = ["/archive/yangjadeulyi-teuraenjiseuteo/"]
|
||||
title = "양자들의 트랜지스터와 핫 캐리어 효과"
|
||||
|
||||
+++
|
||||
|
||||
|
||||
트랜지스터가 점점 소형화가 되어가면서 전자가 예상한대로 움직이지 않는 작은 단위까지 내려갔다. 나노단위까지 생산공정이 작아지면서 양자역학적인 효과가 나타나기 시작했고, 이는 트랜지스터의 스위칭 작용을 방해하는 효과를 불어일으킨다. 이를 해결하기 위해서 양자 세계에서 사용할 수 있는 양자 트랜지스터와 단일 원자 트랜지스터가 개발되었다.
|
||||
|
||||
1) 단일원자 트랜지스터
|
||||
|
||||
단일원자 트랜지스터는 양자 터널링 효과를 적극적으로 이용하여 스위칭 작용을 한다. 터널링 효과를 제어하기 위해서 직접 제어가 아닌 양자 얽힘 효과를 이용한다. 큐비트를 이용하여, 전자 주개로써의 원자를 제어하기 위해 원자 개개별의 스핀 상태를 이용한다. 이를 통해 큐비트의 역할을 할 수 있는 단일한 원자를 생성해 내고, 이 단일 원자들이 스위칭 작용을 하는 주체가 된다. 단일 원자 트랜지스터는 실온에서 작동하고, 적은 숫자의 원자만을 이용하기 때문에 스위칭에 필요한 전력의 양도 매우 적다.
|
||||
|
||||
단일원자 트랜지스터는 실리콘 표면의 인 원자와 반응시키는 방법이 이용된다. 원자가 정해진 위치에 고정되어 있고 각각의 원자가 전자 주개 또는 스위쳐로 작용하여 전자 하나하나의 흐름을 제어하게 된다.
|
||||
|
||||
2) 양자 트랜지스터
|
||||
|
||||
양자 트랜지스터는 기존의 MOS 트랜지스터와 비슷하게 행동하지만, 중간 p,N형 반도체가 하던 채널 형성과 전자 이동 제어를 나노 양자점이 전담하게 된다.
|
||||
|
||||
3) 핫 캐리어 효과
|
||||
|
||||
반도체 공정이 작아지면서 트랜지스터 채널이 소형화되었고, 이에 따라 채널의 길이가 줄어들게 되었다. 채널의 길이가 줄어들면서 전자의 튐 현상과 전자 제어가 힘들어진다는 한계점이 있다. 그 중 핫 캐리어 효과는 Drain전압은 일정한데 비해 짧아진 거리에 의해 전기장이 매우 커지는 효과가 일어나고, 평소보다 훨씬 가속된 전자들의 운동에너지에 의해 원래라면 넘어갈 수 없던 Oxide 전계를 넘어서게 되면서 규소 원자와 충돌하여 갇히게 된다. 이를 핫 캐리어 효과, 빠른 전자에 의한 주입 현상이라고 한다. 이에 의해 예측한 것과는 더 적은 전하가 이동하게 되고, 전류가 불안정하고 수율이 떨어지게 된다.
|
||||
|
||||
핫 캐리어 효과를 최소한으로 하고 이를 방지하기 위해서는 Oxide 게이트와 접해있는 부분의 실리콘을 특수하게 덜 도핑하는 방법이 있다. 전류 손실의 손해를 보지만 핫 캐리어 효과에 의한 손실보다는 훨씬 적다. 원래는 전자의 운동을 최소한으로 방해하기 위해 저항이 낮도록 도핑하는데, Oxide에 접해있는 부분의 저항을 특별히 더 높게 도핑하여 핫 캐리어의 운동을 방해하는 효과를 준다.
|
||||
|
||||
22
content/archive/2021-10-30-spectre-attacks.md
Normal file
22
content/archive/2021-10-30-spectre-attacks.md
Normal file
@@ -0,0 +1,22 @@
|
||||
+++
|
||||
date = 2021-10-30T07:19:36Z
|
||||
description = ""
|
||||
draft = false
|
||||
aliases = ["/archive/1-spectre-attacks-exploiting-peculative-execution/"]
|
||||
title = "Spectre Attacks: Exploiting Speculative Execution"
|
||||
|
||||
+++
|
||||
|
||||
|
||||
The Central Processing Unit (CPU) is a device that plays a major role as the brain of a computer. The CPU controls four main functions: memory, interpretation, computation, and control, which are based on the role of interpreting the commands of a given program to perform operations with data. In CPU, there are the program counter, a command register, an ALU (arithmetic logic unit), a control unit, a bus, and a register. Modern CPUs include cache memory or error correction devices for faster performance and more accurate computation.
|
||||
|
||||
The current CPU follows the Von-Neumann structure, which includes four functions: Fetch, Deocde, Execute, and Writeback. Ancient CPUs interpret instructions in order to convert data, which only can be slow. Modern CPUs speed up through out-of-order. Out-of-Order means that the CPU executes commands dynamically as the input data and execution units, rather than in a original order. This requires the cache memory as mentioned above, and uses Branch Prediction and Specific Memory Disambiguation, which results in Meltdown and Spectre vulnerabilities.
|
||||
|
||||
One day, I heard a news about Spectre and Meltdown Attack with my father. It said that it can affect within all of modern CPU manufactured in Intel, and also other companies. To defent that massive attack, we have to take a decrement of CPU’s performance about half of entire CPU or more. Me and father thought that it is a big event that will effect the history of architecture of modern CPUs. And also will effect on the semiconductor development. After that day, I wanted to learn about the modern architecture of CPUs and basic operations of modern semiconductors. So I searched internet about it, read a university books to understand it, and also a paper written by many eminent researchers, like professor of KAIST and Samsung Semiconductor research center. After the days of learing CPUs, I finally read the paper of Spectre attack and Meltdown attack. It was hard for me to read, but I rarely can understand the way they found it. I also could understand how it works, and how to prevent it to happen. My knowledge about computer and semiconductors increased very fast after I read the entire paper. I can understand how CPU ultimately works, how to make a semiconductor, and also what I have to do to do what I want. Futhermore, I wanted to know the real of semiconductor design, manufacturing, and CPU designing. To learn that thing, I want to learn semiconductor professionally in universities.
|
||||
|
||||
Physical techniques and physically performed computations for improving and stabilizing the performance of modern CPUs often exhibit errors. Side-Channel attck aims to exploit vulnerabilities in these physical computational defects to obtain information that could not be obtained. Among these Side-Channel attacks, Spectre attack uses a buffer for Branch Prediction and Prediction History. This physical operation allows access to unacceptable memory. Branch prediction is a feature that improves execution performance by predicting true/false conditions when a processor executes code containing conditional statements such as if. When the processor encounters a conditional statement, it first predicts the outcome of the conditions it encounters, and first continues to execute the code based on the prediction. The processor calculates the results of the conditions while the code is running as predicted. When the results of the conditions are calculated, the processor verifies the results of the previously made predictions. If a prediction is previously correct, the execution continues and thus gains performance benefits. On the other hand, if the prediction is determined to be incorrect during execution as predicted, the result of the condition is returned to the predicted point and executed again. Spectre attack uses an attack method that allows an attacker with control flow to follow fragments of the machine language code of the targeted process and perform the desired task. An attacker discovers and executes parts of the target process that have the command he or she wants before returning. Since the attacker is free to change the control flow, changing the address of the return command to the address of the next instruction that the attacker wants to execute, even though the execution flow proceeds only within the target process.
|
||||
|
||||
There are two typical cases of Spectre discovered by researchers. Exploiting Conditional Branches and Bounds Check Bypass or Exploiting Indirect Branches and Branch Target Injection are known as Spectre attack. The way Bound Check Bypass work lies in the Speculative Execution by Branch Prediction. If there is an “if” or “while” statement in front of a code that causes Fault when accessed, the CPU is tricked into accessing data in the restricted area and stored in cache to allow this check to be checked. The value of the cache can then be determined using a time difference measurement to read the memory in the inaccessible zone. Branch Target Injection also uses Speculative Execution by Branch Prediction. If the attacker's precess repeats the branch to the location where the attack code, the code to be rejected, the location is stored in the Branch Target Buffer. The characteristic that all processes share the same Branch Target Buffer allows them to reject attack codes into the victim process.
|
||||
|
||||
Wikipedia / Spectre & Meltdown Original Paper
|
||||
|
||||
13
content/archive/2022-05-12-iptime-ax2004m.md
Normal file
13
content/archive/2022-05-12-iptime-ax2004m.md
Normal file
@@ -0,0 +1,13 @@
|
||||
---
|
||||
title: Installing OpenWRT on ipTIME AX2004M
|
||||
date: 2022-05-12T15:01:00.000Z
|
||||
---
|
||||
## Installing OpenWRT on ipTIME AX2004M
|
||||
|
||||
### Disassembly, UART console
|
||||
|
||||

|
||||
|
||||

|
||||
|
||||

|
||||
46
content/archive/2022-12-15-vae-loss-function.md
Normal file
46
content/archive/2022-12-15-vae-loss-function.md
Normal file
@@ -0,0 +1,46 @@
|
||||
---
|
||||
title: VAE의 손실 함수
|
||||
date: 2022-12-15T11:21:46.836Z
|
||||
aliases: ["/archive/VAE의-손실-함수/"]
|
||||
---
|
||||
VAE의 손실 함수는 Variational Lower Bound(VLB)라고도 불리는데, 이 함수는 VAE에서 사용되는 정보량을 측정하는데 사용됩니다. 이 함수는 두 부분으로 나뉘어져 있으며, 이를 분리하여 계산하는 것이 일반적입니다. 이 때, reparametrization trick이란 기법을 사용하면 VAE의 손실 함수의 그래디언트를 계산하는 데 도움이 될 수 있습니다.
|
||||
|
||||
먼저, VAE의 손실 함수는 아래와 같이 정의됩니다.
|
||||
|
||||
$$L = \mathbb{E}{q(z|x)}\[\log p(x|z)] - D{KL}(q(z|x)||p(z))$$
|
||||
|
||||
여기서 $p(x|z)$는 인코더의 출력을 디코더의 입력으로 넣었을 때 생성되는 값을 의미하고, $p(z)$는 잠재 변수의 확률 분포를 의미합니다. $q(z|x)$는 인코더의 출력을 잠재 변수의 확률 분포로 추정한 것을 의미하며, $D_{KL}$은 클로저-라이브러리 발산을 의미합니다.
|
||||
|
||||
이를 분리하여 계산하면 아래와 같이 나뉩니다.
|
||||
|
||||
$$L = \mathbb{E}{q(z|x)}\[\log p(x|z)] - D{KL}(q(z|x)||p(z))$$
|
||||
|
||||
$$= \mathbb{E}{q(z|x)}\[\log p(x|z)] - \mathbb{E}{q(z|x)}\[\log \frac{q(z|x)}{p(z)}]$$
|
||||
|
||||
이때, reparametrization trick을 이용하면 손실 함수의 그래디언트를 쉽게 계산할 수 있습니다. 이 기법은 잠재 변수의 확률 분포를 정의할 때, 정규 분포의 모수를 함수로 표현하는 것을 의미합니다. 이렇게 하면 잠재 변수의 확률 분포를 명시적으로 정의할 수 있어 그래디언트를 계산하기 쉬워집니다.
|
||||
|
||||
|
||||
|
||||
예를 들어, $q(z|x)$를 아래와 같이 정의할 수 있습니다.
|
||||
|
||||
$$q(z|x) = \mathcal{N}(\mu(x), \sigma^2(x))$$
|
||||
|
||||
여기서 $\mu(x)$와 $\sigma^2(x)$는 인코더의 출력을 이용해 계산된 정규 분포의 모수입니다. 이렇게 정의된 $q(z|x)$를 이용하면 손실 함수의 그래디언트를 아래와 같이 계산할 수 있습니다.
|
||||
|
||||
$$\frac{\partial L}{\partial \theta} = \frac{\partial}{\partial \theta}\mathbb{E}{q(z|x)}\[\log p(x|z)] - \frac{\partial}{\partial \theta}\mathbb{E}{q(z|x)}\[\log \frac{q(z|x)}{p(z)}]$$
|
||||
|
||||
$$= \mathbb{E}{q(z|x)}\left\[\frac{\partial}{\partial \theta}\log p(x|z)\right] - \mathbb{E}{q(z|x)}\left\[\frac{\partial}{\partial \theta}\log \frac{q(z|x)}{p(z)}\right]$$
|
||||
|
||||
|
||||
|
||||
이때, 위 식의 첫 번째 항을 전개하면 다음과 같습니다.
|
||||
|
||||
$$\mathbb{E}_{q(z|x)}\left\[\frac{\partial}{\partial \theta}\log p(x|z)\right] = \int q(z|x)\frac{\partial}{\partial \theta}\log p(x|z) dz$$
|
||||
|
||||
여기서 $\theta$는 VAE에서 사용되는 모든 매개변수를 의미합니다. 따라서 이 식을 이용하면 VAE의 손실 함수의 그래디언트를 계산할 수 있습니다.
|
||||
|
||||
|
||||
|
||||
예를 들어, 손실 함수가 $L = \mathbb{E}{q(z|x)}\[\log p(x|z)] - D{KL}(q(z|x)||p(z))$인 경우에는 첫 번째 항의 그래디언트는 다음과 같이 계산할 수 있습니다.
|
||||
|
||||
$$\frac{\partial}{\partial \theta}\mathbb{E}{q(z|x)}\[\log p(x|z)] = \mathbb{E}{q(z|x)}\left\[\frac{\partial}{\partial \theta}\log p(x|z)\right]$$
|
||||
59
content/archive/2023-05-06-usb-c-dp-alt.md
Normal file
59
content/archive/2023-05-06-usb-c-dp-alt.md
Normal file
@@ -0,0 +1,59 @@
|
||||
---
|
||||
title: USB-C & DP Alt
|
||||
date: 2023-05-06T12:55:32.000Z
|
||||
---
|
||||
|
||||
### USB 3-s
|
||||
|
||||
3.2 Gen1 x1 : 5Gbps x1 Lane = 5Gb
|
||||
|
||||
3.2 Gen2 x1 : 10Gbps x1 Lane = 10Gb
|
||||
|
||||
3.2 Gen1 x2 : 5Gbps x2 Lane = 10Gb
|
||||
|
||||
3.2 Gen2 x2 : 10Gbps x2 Lane = 20Gb
|
||||
|
||||
|
||||
> USB 3.0 == USB 3.1 Gen 1 == USB 3.2 Gen 1 x 1
|
||||
>
|
||||
> USB 3.1 == USB 3.1 Gen 2 == USB 3.2 Gen 2 x 1
|
||||
>
|
||||
> So basically USB 3.X doesnt mean actual "interface version". it means version of "naming" version.
|
||||
|
||||
|
||||
### Surface Laptop 4
|
||||
|
||||
- Surface Laptop 4 supports **USB 3.2 Gen 2 x 1 (10Gbps x1 lane)** along with DP-Alt mode. So theoratically it can support 2-lane DP 1.4 High Bit Rate 3 mode, which is 8.1Gbps per lane total 16.2Gbps, which is sufficient for **two** 4K60Hz displays.
|
||||
|
||||
USB-C has 4-pair SuperSpeed links, totaling 2 lanes. So if we use x1 versions, (as Gen1x1 and Gen2x1), there is one lane that is just left over. We can use that to run other interface, like DP or Analog signals. Since DP doesn't require RX/TX pair and rather just TX links, we can use two differential pair as two lanes.
|
||||
|
||||
---
|
||||
|
||||
### about my laptop
|
||||
|
||||
Surface Laptop 4
|
||||
|
||||
It only 've been two years, but its already my most used thing in my entire life.
|
||||
|
||||
The one and only thing I cannot give up from this laptop is this perfectly made 3:2 ratio display, which gives me ~5cm clearance vertically. Its like I have dedicated display space for panel (titlebar, or taskbar), and yet its still most tall display ever. Its like actually useful TouchBar.
|
||||
|
||||
The only thing I hate about it is battery and I/O port, and maybe display resoultion. Even only with Linux and basic internet browsing battery drains really fast, it can barely hold up 3 hours. But its Intel laptop.. what do you expect, right?
|
||||
|
||||
Also it has only one USB-A port, one USB-C port (NOT THUNDERBOLT), and one PROPRIETART crap port. Oh, and 3.5mm combo jack.. I mean that's fine, I dont use Thunderbolt anyways.. and I use wireless mouse all the time so its just bit annoying..
|
||||
|
||||
But one thing. This one thing really annoys me.
|
||||
|
||||
2496x1664 2K display.
|
||||
|
||||
Yeah 4K will drain my battery in less than hour and FHD is too bad these days, but 2K is really bad resolution for 38cm (15in) displays.. Why? It forces us to use... "Fractional Scaling".
|
||||
|
||||
100% scaling for those display would be too small, and 200% scaling will be too big. So we need to use 150% scaling (which is fine in most case) but since its "3/2" percent, it makes them to render at "half of pixel", which causes a bunch of problem.
|
||||
|
||||
Fundamentally it would render anything blurry, or at most incorrectly. macOS was the first who adapted high-res retina display so they handle it beautifully, and since Windows is commertially sold and big company-backed, it handles it just only bad enough that is fine enough. Linux, is always a problem.
|
||||
|
||||
Linux has two GUI system. Old X11 and new Wayland. X11 is really old protocol, designed for like terminal monitors and stuff. We cant use that on those 4K high res monitors, so we need new protocol to handle it thus Wayland. As you might already know, Linux is bad at adapting new technologies. It's taking eternity for linux ecosystem to switch to Wayland, but right on these days it's becoming feasible to use Wayland.
|
||||
|
||||
In case of fractional scaling, X11 solve it like maxOS. it over-renders it and scale-down to display. it would add quite a bunch of overhead to graphical system, but at least it would look good and crisp and elegant.
|
||||
But its not ""correct"", so Wayland handles it properly by actually using pixel-level to render. So we can think as "0.5x zooming 30px font" and "15px font". In some case, x0.5 zooming can look more crisp and better, but 15px will be accurate.
|
||||
|
||||
I think most people will prefer "crisp inaccurate" than "blurry accurate", and I also prefer it, so
|
||||
@@ -0,0 +1,72 @@
|
||||
---
|
||||
title: Toward an Electronically-Mediated Decentralized Society
|
||||
date: 2023-10-04T21:50:35.465Z
|
||||
description: The Evolution of Democracy in the Digital Age
|
||||
---
|
||||
In the long and evolving tapestry of human civilization, each era has been defined by the tools it has harnessed and the political ideologies it has embraced. From the agrarian societies governed by monarchies to the industrial age's democratic revolutions, the interplay between technology and governance has constantly shaped the contours of societies. Today, as we stand at the crossroads of an unprecedented digital revolution, it's imperative to reflect on this intricate relationship once more. We find ourselves in a digital age where information flows at the speed of light, yet the foundational principles of governance in many societies remain rooted in centuries-old traditions. As trust in conventional democratic institutions wavers, and as technology offers new means of decentralisation and transparency, there emerges a potential to marry the philosophical ideals of decentralism with the determinism of electronic systems. This convergence promises a vision of a more equitable, participatory, and transparent society. Yet, to chart this course, one must delve deep into the historical contexts, understand the digital backdrop, examine the shifting sands of trust in governance, and ultimately, explore the potential of an decentralistic deterministic society. As we embark on this exploration, this introductory essay aims to lay the groundwork for the forthcoming detailed analysis, offering insights into how we might reimagine society in the digital age.
|
||||
|
||||
#### **Historical Context: The Evolution of Trust in Governance**
|
||||
|
||||
The annals of human history are littered with tales of governance—stories of leaders, of revolutions, of grand visions, and of the ordinary citizen. At the heart of these tales lies a singular, unifying thread: trust. This trust has been the cornerstone upon which edifices of governance, from monarchies to democracies, have been erected. In the ancient city-states of Greece, where democracy found its earliest expression, trust was an unwritten social contract. Citizens trusted one another's judgment in the agora, just as they trusted their representatives in the proto-democratic institutions. As empires expanded and nation-states emerged, so did the complexities of governance. The Renaissance era, with its emphasis on individual freedoms and rights, led to new social contracts where the monarch's divine right to rule was increasingly questioned, and in its place, the concept of a government 'by the people, for the people' began to take root.
|
||||
|
||||
But trust in governance has never been static. The Enlightenment period brought forth a wave of revolutions—American, French, and beyond—each fueled by the discontent of the masses who felt betrayed by the promises of their rulers. These upheavals were manifestations of broken trust, yet they also sowed the seeds for modern democracies, with checks and balances crafted meticulously to prevent such breaches. As industrialization swept across continents, democratic institutions adapted, introducing representative systems to manage the sheer scale of populations and their diverse needs. These systems, while imperfect, were anchored in trust. People trusted the process, the institution, and most importantly, the ethos of democracy.
|
||||
|
||||
Fast forward to the 20th century, with its world wars, cold wars, and rapid decolonization. Trust was tested at every juncture. International institutions like the United Nations were born out of a dire need to rebuild trust among nations. Similarly, post-colonial nations embarked on journeys to establish democratic roots, seeking to build trust within diverse and often divided populations. Yet, as the century waned, so did the unequivocal trust in democratic institutions. Scandals, political polarizations, economic disparities, and the emerging influence of media began chipping away at the once solid bedrock of trust. As we transitioned into the 21st century, the pace of change has been breathtaking. Globalization, technological advancements, and now the digital revolution have added layers of complexity to the already intricate tapestry of governance. With information at one's fingertips and global events unfolding in real-time, the earlier vertical flow of knowledge from governments to citizens has been democratized, leading to a more informed but also more skeptical populace. In this age, trust in traditional structures appears fragile, often wavering under the weight of misinformation, populist rhetoric, and a sense of disenchantment. This evolving historical context underscores the urgency to reevaluate our existing systems and ponder what comes next in the ongoing saga of governance and trust.
|
||||
|
||||
#### **Digital Background: The Proliferation of Technology and its Impact on Governance**
|
||||
|
||||
The digital age, often characterized as the Fourth Industrial Revolution, has ushered in transformative shifts across all sectors of society, with governance being no exception. As we examine this metamorphosis, it becomes evident that the intersection of technology and governance is not just a recent phenomenon but an evolutionary process that has been unfolding over decades.
|
||||
|
||||
The 20th century saw the advent of computerization, which started as a ripple with room-sized machines crunching numbers, and gradually evolved into a tidal wave as personal computers found their way into homes by the 1980s. Governments worldwide recognized the potential of these technologies, leading to the digitalization of records, automation of bureaucratic processes, and the establishment of e-governance platforms. While these initial steps were transformative, they were just the tip of the iceberg.
|
||||
|
||||
The dawn of the internet in the late 20th century brought about the most significant paradigm shift. Suddenly, information wasn't just a commodity; it was the lifeblood of a rapidly globalizing world. Governments began to grapple with the double-edged sword that the internet represented. On one side, it promised unparalleled transparency, efficiency, and citizen engagement. On the other, it posed challenges related to cybersecurity, privacy, and the potential spread of misinformation.
|
||||
|
||||
The rise of social media platforms in the 2000s intensified these dynamics. Political campaigns, policy discussions, and public debates shifted from town halls and newspapers to Twitter feeds and Facebook timelines. The Arab Spring of 2011, which saw governments toppled through grassroots movements coordinated on social media, was a testament to the profound power of digital platforms in shaping political destinies.
|
||||
|
||||
But beyond the evident macro shifts, the digital age has also redefined the minutiae of governance. Blockchain technology, for instance, offers transparent and tamper-proof record-keeping, reshaping everything from voting systems to land registries. Artificial intelligence and big data analytics allow governments to make more informed decisions by analyzing vast amounts of data, leading to insights previously unimaginable. However, these technologies also carry ethical dilemmas, especially around surveillance, data privacy, and algorithmic biases.
|
||||
|
||||
Furthermore, the rapid rise of the Internet of Things (IoT) means that cities and their infrastructures are becoming smarter, heralding the era of smart governance where urban planning, public transport, and even waste management are driven by real-time data and automation.
|
||||
|
||||
Yet, as we stand amidst this digital revolution, it's imperative to recognize the challenges. The digital divide, which denotes the gap between those with and without access to digital technologies, is a growing concern. In many parts of the world, access to the internet remains a privilege, not a right. Ensuring that the benefits of digital governance are equitable and do not exacerbate existing inequalities is crucial.
|
||||
|
||||
Moreover, as cyber threats become more sophisticated, governments find themselves in a perpetual race to bolster cybersecurity defenses. In a world where cyber warfare can have as dire consequences as traditional warfare, establishing international norms and protocols becomes paramount.
|
||||
|
||||
In conclusion, the digital background of our era offers both immense possibilities and challenges for governance. Harnessing technology for transparent, efficient, and inclusive governance requires a delicate balance, taking into account both the potentials of these tools and the ethical and practical concerns they introduce.
|
||||
|
||||
#### **The Erosion of Trust and the Reimagining of Democracy in Modern Times**
|
||||
|
||||
Trust, a seemingly intangible concept, has been the linchpin of societies throughout history. As elucidated in our exploration of the historical context, trust has been the backbone of governance structures, from ancient city-states to modern democracies. However, as the digital age envelopes society, the traditional pillars of trust appear increasingly shaky, necessitating a critical examination of the dynamics at play and the possible pathways forward.
|
||||
|
||||
In an era of information superabundance, the gatekeepers of yesteryears—traditional media outlets, academic institutions, and governmental bodies—no longer hold a monopoly over the narrative. Today, a tweet, a blog post, or a viral video can sway public opinion with unparalleled potency. While this democratization of information carries the potential to amplify marginalized voices, it also provides a fertile ground for misinformation, deep fakes, and echo chambers. As falsehoods intermingle seamlessly with facts, discerning the truth becomes a Herculean task, eroding public trust in institutions and narratives.
|
||||
|
||||
This erosion is further exacerbated by the contemporary political climate. Populist movements worldwide, often rooted in nationalist or protectionist ideologies, have capitalised on this trust deficit. Their rhetoric often paints institutions, be they governmental, academic, or media, as 'elites' detached from the realities of the common citizen. Such narratives, whether wholly accurate or not, further widen the chasm of distrust, rendering constructive dialogues and collaborative solutions more elusive.
|
||||
|
||||
However, the digital age doesn't merely present challenges to trust; it also offers tools to rebuild it. Take, for instance, the concept of digital transparency. Governments and organizations can leverage technology to provide real-time insights into their operations, decision-making processes, and financial transactions. Estonia's e-governance model stands as a testament to this, where citizens can track their data's journey across governmental systems, fostering transparency and accountability.
|
||||
|
||||
Yet, transparency alone might not suffice. As the dynamics of trust shift, so should the structures of governance. The concept of 'direct democracy' gains renewed relevance in this context. If the traditional representative model of democracy, with its layers of bureaucracy and intermediation, appears out of sync with the zeitgeist, then perhaps it's time to explore more direct, participatory models. Digital platforms can facilitate real-time referendums, policy discussions, and even decentralized decision-making. The Swiss model of direct democracy, where citizens regularly vote on a plethora of issues, offers a glimpse into such possibilities, albeit in a non-digital context.
|
||||
|
||||
However, as with any paradigm shift, this reimagining carries inherent risks. Direct democracy, in the absence of checks and balances, can morph into mob rule, swayed by transient emotions rather than reasoned debate. The challenge lies in crafting a model that marries the ethos of direct participation with mechanisms that ensure informed, balanced decision-making.
|
||||
|
||||
In essence, the digital era has ushered in a period of introspection and potential transformation for democratic governance. While trust in traditional structures wanes, the tools to sculpt a more participatory, transparent, and accountable system lie within our grasp. The onus is on societies worldwide to tread this path judiciously, balancing the promises of the digital age with its perils.
|
||||
|
||||
#### **Decentralism, Deterministic Democracy, and the Path to an Equitable Future**
|
||||
|
||||
In the search for a more equitable and truly democratic society, the tenets of decentralism emerge as both a historical touchpoint and a potentially revitalized philosophy in the context of our digital era. Traditionally, decentralism advocates for the abolition of centralized authority and coercive hierarchies, envisioning a society where individuals freely cooperate based on mutual aid and shared values. The goal is not chaos, as common misconceptions might suggest, but rather a society built on organic relationships and self-governance.
|
||||
|
||||
This brings us to an intriguing juxtaposition: Can the principles of decentralism coalesce with the promise of modern digital tools to form a new, more equitable system of governance? And can this union address the challenges of trust and representation that plague our contemporary democracies?
|
||||
|
||||
Consider the very nature of the digital realm. Open-source software, decentralized platforms, and blockchain technologies are inherently decentralistic in their design. They defy central control, emphasize transparency, and promote collaboration. Applied to governance, these technologies could pave the way for a deterministic form of democracy, where systems function predictably based on transparent algorithms, and citizens can directly influence or even craft these algorithms to ensure fairness and representation.
|
||||
|
||||
In this envisioned future, voting systems could be open-source, allowing for collective oversight and reducing the potential for manipulation. Decision-making processes could be decentralized, enabling direct participation and reducing the layers of bureaucracy that often dilute the citizen's voice. The deterministic nature of digital systems could provide a framework wherein societal functions operate transparently, predictably, and in the best interests of all.
|
||||
|
||||
Yet, as with any transformative idea, challenges abound. How do we ensure that these deterministic systems, while predictable, do not become rigid and unresponsive to evolving societal needs? How do we ensure digital inclusivity, giving a voice to those who might be marginalized in a tech-driven governance model? And most importantly, how do we strike a balance between the principles of decentralism and the practicalities of managing large, diverse populations?
|
||||
|
||||
The journey from the trust-laden democracies of old to the current state of skepticism, and the potential leap towards a deterministic, decentralistic future, is rife with both promise and peril. The digital tools at our disposal offer a tantalizing glimpse of a world where power is decentralized, systems are transparent, and the individual's agency is paramount.
|
||||
|
||||
However, the path to this future is not linear. It requires careful navigation, an understanding of historical contexts, a grasp of digital potentials, and a profound respect for the human elements of trust, collaboration, and mutual respect. As societies globally grapple with the challenges of the present, it becomes imperative to draw from the past, leverage the tools of the present, and craft a vision for the future that truly embodies the ideals of equity, representation, and shared prosperity.
|
||||
|
||||
In this grand tapestry of governance and societal evolution, every individual has a role to play. By fostering dialogues, challenging the status quo, and remaining open to transformative ideas, we can collectively inch closer to a world that, while perhaps not perfect, is fairer, more democratic, and truly reflective of the collective will.
|
||||
|
||||
|
||||
|
||||
*Originally written in Korean. Mainly translated by LLM.*
|
||||
615
content/archive/2023-10-27-gptlog-nuclear-fission.md
Normal file
615
content/archive/2023-10-27-gptlog-nuclear-fission.md
Normal file
@@ -0,0 +1,615 @@
|
||||
---
|
||||
title: Chat with GPT, about Nuclear Fission
|
||||
date: 2023-10-27T09:10:25.000Z
|
||||
description: ""
|
||||
---
|
||||
I made GPT create a new question about GPT's response, and repeated it for 10 minutes.
|
||||
|
||||
This is log for it.
|
||||
|
||||
|
||||
|
||||
#### Question:
|
||||
|
||||
What is nuclear fission reactor, and what is breeder reactor?
|
||||
|
||||
#### Answer:
|
||||
|
||||
A nuclear fission reactor is a device used to initiate and control a self-sustained nuclear chain reaction. These reactions are used to generate heat, which is typically used in steam turbines to produce electricity in a nuclear power station.
|
||||
|
||||
In a fission reactor, heavy atomic nuclei, such as those of uranium or plutonium, are split into lighter nuclei through a process called nuclear fission. This process releases a considerable amount of energy, along with two or more neutrons. These neutrons can then induce further fissions, which release more neutrons, and so on. This can be controlled and sustained as a chain reaction, and is the fundamental process in a nuclear reactor.
|
||||
|
||||
A breeder reactor, on the other hand, is a type of nuclear fission reactor that is designed to generate more fissile material (nuclear fuel) than it consumes. This is achieved by surrounding the fission core of the reactor with a blanket of material (like uranium-238) that can capture neutrons and transform into a fissile material (like plutonium-239).
|
||||
|
||||
Breeder reactors aim to make better use of the nuclear fuel resources available. It's called a "breeder" because it breeds new fuel. Compared to other types of reactors which waste a lot of the nuclear potential of the fuel, breeder reactors maximize the energy obtained from the nuclear fuel. The advantage of using breeder reactors is that they have the potential to extract almost all of the energy contained in uranium or thorium, decreasing the volume of nuclear waste and extending the use of these fuels for many thousands of years.
|
||||
|
||||
#### Question:
|
||||
|
||||
How can we optimize the design of a nuclear breeder reactor to maximize the production
|
||||
of fissile material while minimizing the production of radioactive waste?
|
||||
|
||||
#### Answer:
|
||||
|
||||
Optimizing the design of a nuclear breeder reactor to maximize the production of fissile material and minimize the production of radioactive waste involves a series of complex scientific and engineering challenges. Here are a few technical approaches:
|
||||
|
||||
1. **Fuel Type and Assembly**: Fast breeder reactors (FBRs) typically use a mix of uranium and plutonium, where the fuel assembly design is crucial. In order to create a situation where more fuel is produced than consumed, the fuel rods are surrounded by a "blanket" of depleted uranium, which captures fast neutrons and converts non-fissile U-238 into fissile Pu-239.
|
||||
2. **Neutron Economy** : Maximizing the production of fissile material also requires careful management of neutron economy. Every neutron that is absorbed without causing fission is a neutron lost to the breeding process. Therefore, the materials and geometry of the reactor are designed to minimize neutron losses.
|
||||
3. **Coolants & Moderators**: The selection of coolant and absence of moderator are also important. Fast breeder reactors use liquid metal coolants, such as sodium, which do not slow down neutrons as much as traditional coolants. Since fast neutrons are required for breeding, this design increases the overall breeding ratio.
|
||||
4. **Reprocessing & Recycling**: The spent fuel contains valuable fissile material. Reprocessing and recycling of spent fuel can potentially recover this material, reducing both the need for fresh fuel and the amount of high-level waste.
|
||||
5. **Waste management**: Designing a reactor to minimize waste production requires an understanding of the nuclear reactions and isotopes produced. The reactor can be designed to burn off longer-lived transuranic waste while producing short-lived fission products.
|
||||
6. **Shielding & Containment**: Shielding and containment structures play an important role in containing and reducing any radioactive waste leakage.
|
||||
|
||||
It's important to note that while breeder reactors have the potential to greatly extend our nuclear fuel supply, they come with significant technical, economic, and proliferation challenges.
|
||||
|
||||
#### Question:
|
||||
|
||||
How can advanced materials and fuels be designed to enhance the efficiency and safety of nuclear breeder reactors while reducing the potential for nuclear proliferation?
|
||||
|
||||
#### Answer:
|
||||
|
||||
Designing advanced materials and fuels for nuclear breeder reactors often comes down to two key aspects: enhancing efficiency and safety, and reducing the potential for nuclear proliferation. This is certainly a complex and multifaceted question, but I can explain a few strategies that scientists and engineers use:
|
||||
|
||||
1. **Advanced Fuel Designs**: The fuel used in breeder reactors is typically a mix of fissile material like plutonium-239 and fertile material such as uranium-238. New advanced fuel designs often involve using a mix of different elements, such as adding other actinides that can also be transmuted into fissile materials. These other elements can not only increase the amount of fissile material produced but also make it more difficult to use the produced plutonium for weapons, reducing proliferation risk.
|
||||
2. **Advanced Coolant Materials**: The efficiency and safety of nuclear reactors can be improved by optimizing the materials used in the coolant system, which removes heat from the reactor core. For instance, liquid metal coolants like sodium or lead can operate at high temperatures without high pressures, improving thermal efficiency and reducing the risk of pressure-related accidents.
|
||||
3. **Cladding Materials**: The cladding is the material that encases the fuel in the reactor. It must be corrosion-resistant, must not absorb too many neutrons (to avoid reducing the efficiency of the reactor), and must withstand high temperatures and radiation levels. Advanced cladding materials, such as silicon carbide, are being researched and can potentially improve both safety and efficiency.
|
||||
4. **Reprocessing**: Reprocessing is a method where spent nuclear fuel is chemically processed to separate out useful elements that can be reused as fuel. This can help enhance efficiency by making more use of the fuel, and also reduce waste. However, it also poses proliferation risks, as it involves handling and potentially producing weapons-usable materials.
|
||||
5. **Non-Proliferative Fuel Cycles**: Researchers are studying potential fuel cycles that could greatly reduce proliferation risk. An example is the uranium-233/thorium-232 cycle, where the uranium-233 is denatured with uranium-238, making it unsuitable for weapons uses.
|
||||
|
||||
Remember, while these strategies can reduce risks and improve efficiency, they don't eliminate all challenges or problems. It's a complex balancing act that requires careful engineering and policy decisions.
|
||||
|
||||
#### Question:
|
||||
|
||||
How can advanced computational modeling and simulation techniques be used to accurately predict and optimize the performance of advanced materials and fuels in nuclear breeder reactors?
|
||||
|
||||
#### Answer:
|
||||
|
||||
Advanced computational modeling and simulation techniques play a crucial role in the analysis and design of modern nuclear breeder reactors. They are tools scientists use to predict behavior of the fuel and material in a nuclear reactor, which would be too complicated, expensive, dangerous, or even impossible to observe directly.
|
||||
|
||||
The design and optimization of materials and fuels for breeder reactors using computational techniques generally involve the following steps:
|
||||
|
||||
1. **Microscopic Scale**: At the atomic level, quantum mechanical simulations like Density Functional Theory (DFT) or Monte Carlo simulations can be used to understand and predict the behavior of materials under radiation, their mechanical and thermal properties, diffusion of atoms, and formation of defects or precipitates.
|
||||
2. **Mesoscopic Scale**: Phase field simulations, cellular automata, lattice kinetic Monte Carlo, or discrete dislocation dynamics can model the microstructural evolution, grain boundary movement, or dislocation dynamics to predict material properties.
|
||||
3. **Macroscopic Scale**: At a larger scale, Finite Element Analysis (FEA) or Computational Fluid Dynamics (CFD) can model stress-strain behaviors, deformation, or heat transfer in the reactor components under different conditions.
|
||||
4. **Neutronics Simulations**: These simulate the neutron population in a nuclear reactor over time. Monte Carlo methods or deterministic methods like the method of characteristics can be used. This helps understand and predict fuel burnup, power distribution, or reactor kinetic behaviors.
|
||||
|
||||
A successful optimization would aim for materials and fuels that demonstrate superior thermal properties, stand up to high radiation with less damage (high radiation tolerance), and limit the transmutation to less harmful isotopes or those that can be reused as fuel.
|
||||
|
||||
As far as reducing nuclear proliferation is concerned, computational modeling can help explore designs that limit production or ease of access to weapons-usable materials.
|
||||
|
||||
In conclusion, advanced computational modeling and simulation techniques are indispensable tools in the design and optimization of nuclear breeder reactors. They give scientists and engineers the ability to predict and control complex behaviors, ultimately leading to safer, more efficient, and more proliferation-resistant reactors.
|
||||
|
||||
#### Question:
|
||||
|
||||
How can quantum simulations be leveraged to study the behavior of advanced materials and fuels in nuclear breeder reactors at an atomic scale?
|
||||
|
||||
#### Answer:
|
||||
|
||||
Quantum simulations or quantum mechanical simulations are a powerful tool that apply the principles of quantum mechanics to predict and understand the behaviors of particles at the atomic and subatomic level. They can provide valuable insights into the properties of advanced materials and fuels at an atomic or molecular level.
|
||||
|
||||
In the context of nuclear breeder reactors, quantum simulations could be utilized in several ways:
|
||||
|
||||
1. **Structural Analysis:** Quantum simulations can predict the atomic-scale structure of the fuels. This includes details about defects or deformities, electron distribution, and reaction rates, giving hints on how a material may behave under extreme conditions typical of nuclear reactors.
|
||||
2. **Thermodynamic Properties:** Quantum simulations can predict properties like heat capacity, thermal expansion coefficients, melting points, and more. This information is useful to predict how materials handle high-temperature situations inside a reactor.
|
||||
3. **Reactivity and Transmutation Analysis:** Quantum simulations can be used to study the transmutation of elements, which is crucial in a breeder reactor where fuel atoms are transformed into different isotopes and elements.
|
||||
4. **Radiation Damage Analysis:** Quantum simulations can study the effects of radiation on materials, predicting how they'll respond to neutron radiation in the reactor. This would help in developing materials that have a better resistance to radiation damage.
|
||||
|
||||
While simulation offers many potential advantages, their accuracy relies upon the physical models and parameters used. This kind of simulations also requires advanced computational capabilities due to the complex nature of quantum mechanical calculations, and interpretation of results often requires a deep understanding of both nuclear physics and reactor engineering.
|
||||
|
||||
But despite these challenges, the use of quantum simulations to study the behavior of advanced materials and fuels in nuclear reactors stands as an exciting area of research that could significantly advance our understanding and hence improve the design and operation of these complex systems.
|
||||
|
||||
#### Question:
|
||||
|
||||
How can the principles of quantum mechanics be utilized to develop new materials with enhanced properties for use in nuclear breeder reactors?
|
||||
|
||||
#### Answer:
|
||||
|
||||
Quantum mechanics, which governs the behavior of particles at atomic and subatomic scales, plays an integral role in the design of new materials for nuclear breeder reactors.
|
||||
|
||||
Firstly, quantum mechanical properties are critical in determining the material's electronic and molecular structure which directly affects its physical and chemical properties. For example, the resistance of a material to radiation-induced damage is related to how its atoms are bonded which is in turn determined by quantum mechanics.
|
||||
|
||||
Secondly, quantum mechanics provides the foundation for computational methods (such as density functional theory) used to predict and optimize properties of materials before they are synthesized. This allows efficient screening and selection of materials with desired properties.
|
||||
|
||||
Thirdly, new quantum effects may be harnessed to create novel materials with improved properties. For example, nanostructured materials, which rely on quantum size effects, can potentially outperform their macroscopic counterparts.
|
||||
|
||||
However, it is important to note that while quantum mechanics can guide the development of new materials, actual implementation also require consideration of other factors such as manufacturability, cost, and safety among others.
|
||||
|
||||
#### Question:
|
||||
|
||||
How can quantum entanglement be harnessed to enhance the efficiency and stability of nuclear breeder reactors?
|
||||
|
||||
#### Answer:
|
||||
|
||||
Quantum entanglement is a quantum mechanical phenomenon in which the quantum states of two or more objects have to be described with reference to each other, even though the individual objects may be spatially separated. This can potentially have significant implications in the field of quantum computing, where quantum entanglement is a key resource for many protocols.
|
||||
|
||||
However, in the context of nuclear breeder reactors, quantum entanglement may not have any direct engineering applications, at least not with our current understanding and technology. The behaviour of nuclear reactors is fundamentally a large-scale, classical physics problem and does not directly involve quantum entanglement at an operational level.
|
||||
|
||||
Many sub-atomic reactions occurring within a nuclear reactor do depend on quantum phenomena, as the behavior of subatomic particles is governed by quantum mechanics. However, the concept of quantum entanglement as used in quantum computing and quantum information, doesn't apply directly to enhancing the efficiency and stability of nuclear reactions.
|
||||
|
||||
On a more theoretical ground, manipulating individual nuclear spins via quantum entanglement could perhaps alter the probability of certain fission or fusion reactions, but such manipulation is well beyond our current technological capabilities and are not the subject of any current research in practical reactor design. Most research into incorporating quantum effects into nuclear reactions is currently theoretical and in very early stages of experimental investigation and not yet applied in practical energy production.
|
||||
|
||||
Nonetheless, the study of quantum phenomena at small scales continues to deepen our understanding of nuclear reactions and could potentially lead to breakthroughs in the future.
|
||||
|
||||
#### Question:
|
||||
|
||||
How can we utilize quantum computing to optimize the design and operation of nuclear breeder reactors, taking into account complex multi-physical phenomena and constraints?
|
||||
|
||||
#### Answer:
|
||||
|
||||
Quantum computing can potentially revolutionize the optimization of nuclear breeder reactor design and operation by handling complex multi-physical phenomena much more efficiently than classical computers.
|
||||
|
||||
Firstly, quantum computing offers exponential speedup for certain computations. For example, simulating the behavior of quantum systems in reactor materials is exponentially hard for classical computers, but can theoretically be done efficiently using a quantum computer. Hence, material properties and reactor performance could be predicted more accurately.
|
||||
|
||||
Secondly, certain optimization problems such as reactor core design and operation scheduling can be framed as quantum annealing problems or other types of quantum optimization problems. Using a quantum annealing approach could potentially find the global optimum more efficiently than classical optimization algorithms.
|
||||
|
||||
However, we should note that the current state of quantum computing is still experimental and practical quantum computing devices are in early stages of development. The utility of quantum computing for nuclear breeder reactor design is a topic of active research and is expected to become viable as quantum technology continues to mature.
|
||||
|
||||
Finally, it's also important to address that the use of quantum computing in nuclear reactor planning must also be undertaken with a comprehensive understanding of the safety, security, and ethical implications associated with the technology.
|
||||
|
||||
#### Question:
|
||||
|
||||
How can we use machine learning algorithms to analyze vast amounts of data generated by nuclear breeder reactors in order to identify patterns and optimize their performance?
|
||||
|
||||
#### Answer:
|
||||
|
||||
Quantum computing and machine learning can be highly beneficial for analyzing the vast amounts of data generated by nuclear breeder reactors. These techniques can help optimize reactor performance, predict potential issues, and devise solutions more efficiently and accurately than traditional methods.
|
||||
|
||||
Machine learning algorithms can analyze large volumes of data to identify patterns that might not be obvious or intuitive to human operators. This could include relationships between different variables, trends over time, or anomalies that could indicate a problem.
|
||||
|
||||
Machine learning can assist in predicting and mitigating potential issues. For example, a machine learning model could forecast when certain components might fail based on their operating conditions and past performance, allowing technicians to perform maintenance before a breakdown occurs.
|
||||
|
||||
Machine learning can also be used to optimize reactor performance. By analyzing historical data on reactor operations, machine learning algorithms can identify the most efficient operating conditions and strategies.
|
||||
|
||||
Quantum computing could bring further benefits. While still a developing technology, quantum computers have the potential to perform calculations and simulations much faster and more accurately than conventional computers. In nuclear reactor design and operation, this could be used to model complex physical phenomena, such as the behavior of fuels and materials under different conditions.
|
||||
|
||||
By combining quantum computing and machine learning, it could be possible to create predictive models and optimization algorithms that are not only more accurate and efficient, but also capable of handling the complexity and volume of data generated by nuclear breeder reactors.
|
||||
|
||||
#### Question:
|
||||
|
||||
How can the integration of artificial intelligence and autonomous control systems improve the safety, efficiency, and overall performance of next-generation nuclear breeder reactors?
|
||||
|
||||
#### Answer:
|
||||
|
||||
Artificial Intelligence (AI) and autonomous control systems can significantly improve the safety and efficiency of next-generation nuclear breeder reactors in several ways.
|
||||
|
||||
1. Automated operation: Autonomous control systems can reduce human error by managing everyday operations of a nuclear reactor. This includes monitoring temperature, pressure, power output levels, and more. By automating these tasks, the system can respond quicker and more accurately than a human operator could in case of a deviation.
|
||||
2. Incident prediction and reaction: AI can be used to predict potential faults or incidents by analyzing historical data and learning to identify signs of a potential problem. If the AI system predicts a potential incident, the autonomous controls can react quickly to mitigate the effects or avoid it.
|
||||
3. Optimization of operation: Machine learning, a subset of AI, can be used to optimize the operation of the reactor. The system can analyze a vast amount of data from the reactor's operation and learn how to optimize its conditions for different requirements.
|
||||
4. Maintenance planning: Predictive maintenance systems can predict when a component might fail or requires attention, reducing the downtime and increasing the efficiency of the overall system.
|
||||
5. Fuel optimization: AI can model and predict the behavior of the reactor's fuel, helping to maximize efficiency and minimize waste.
|
||||
6. Training and simulation: AI can be used to create realistic training simulators for operators, improving safety by providing better training.
|
||||
|
||||
It's important to mention that though these technologies offer significant potentials, their implementation also requires careful considerations in terms of safety, reliability, and cybersecurity.
|
||||
|
||||
#### Question:
|
||||
|
||||
How can we leverage advanced algorithms and data analytics to optimize the operation of nuclear breeder reactors in real-time, considering factors such as fluctuating power demands, fuel availability, and safety constraints?
|
||||
|
||||
#### Answer:
|
||||
|
||||
The leveraging of advanced algorithms and data analytics can play a crucial role in optimizing the real-time operation of nuclear breeder reactors. Various complex parameters and constraints should be taken into account, including fluctuating power demands, fuel availability, and safety precautions.
|
||||
|
||||
Using advanced machine learning algorithms, we can glean insights from collected data to predict reactor performance under a range of conditions. For example, a predictive model could be used to optimize reactor output in response to fluctuating power demands, keeping the system running at its most efficient while preventing any overload.
|
||||
|
||||
Additionally, fuel availability could be better managed through the use of predictive analytics, thus ensuring a sufficient supply of fuel and minimizing the risk of shortages.
|
||||
|
||||
Most importantly, safety is a crucial factor in the operation of any nuclear system. Advanced algorithms can identify unusual patterns in the data, which could be indicative of a potential safety issue. An autonomous control system could then take immediate actions, such as shutting down the reactor or adjusting its performance, to avert a potential crisis.
|
||||
|
||||
Thus, integrating advanced algorithms and data analytics in nuclear breeder reactor operation can significantly enhance efficiency, ensure the constant availability of fuel, and most importantly, improve safety measures.
|
||||
|
||||
#### Question:
|
||||
|
||||
How can we develop advanced machine learning algorithms that can dynamically adapt and optimize the operation of nuclear breeder reactors in response to changing external conditions and internal parameters, while ensuring safety and efficiency?
|
||||
|
||||
#### Answer:
|
||||
|
||||
To develop advanced machine learning algorithms for the dynamic adaptation and optimization of the operations of nuclear breeder reactors, the following principal steps might be necessary:
|
||||
|
||||
1. **Data Acquisition and Preprocessing**: This involves collecting relevant data from the reactor operations. The data would include various parameters such as temperature, pressure, neutron flux, fuel utilization, power output, and more. This data would then be preprocessed to remove any noise and anomalies.
|
||||
2. **Feature Selection**: In this step, relevant features from the data that are critical to predicting the reactor performance are identified. Methods like correlation analysis, principle component analysis (PCA), and mutual information might be used for this purpose.
|
||||
3. **Training the Machine Learning Model**: Once the data is ready, it can be used to train a machine learning model. A model such as a neural network might be suitable due to its ability to handle complex, nonlinear relationships between different parameters.
|
||||
4. **Prediction and Optimization**: The trained machine learning model can be used to predict various performance measures of the reactor based on different operating conditions. The prediction results can then be used to optimize the operation of the reactor. For instance, an optimization algorithm such as a genetic algorithm or a gradient descent could be used to find the optimal operating conditions that maximize the reactor's efficiency while ensuring safety.
|
||||
5. **Online Learning and Adaptation**: Given that reactor conditions and performance can change over time, the machine learning model should ideally be capable of online learning - i.e., continually updating and improving its predictions based on new data. This allows the model to adapt to changing conditions over time.
|
||||
6. **Safety Verification**: At all times, the algorithms should ensure that safety constraints are respected. In addition, these systems should be designed with fail-safe mechanisms to ensure that manual control can be reinstated at any time.
|
||||
|
||||
Implementing such measures entails multidisciplinary knowledge, including domain knowledge of nuclear physics and engineering, machine learning, optimization theory, and control systems. It also demands rigorous testing and validation to ensure the reliability and safety of the algorithms. Ultimately, the integration of such systems could significantly improve the efficiency and safety of nuclear breeder reactors.
|
||||
|
||||
#### Question:
|
||||
|
||||
How can we integrate advanced robotics and sensing technologies into nuclear breeder reactors to enable remote inspection, maintenance, and repair, thereby enhancing safety and reducing the exposure of workers to radiation?
|
||||
|
||||
#### Answer:
|
||||
|
||||
Nuclear breeder reactors, due to their inherent high radiation environment, can certainly benefit from the integration of advanced robotics and sensing technologies.
|
||||
|
||||
Specifically, robotics can be designed to handle tasks that would be too dangerous for humans, including handling radioactive materials, inspecting and monitoring reactor conditions, performing cleaning tasks, and conducting emergency response procedures. Robots equipped with specialized sensors, vision systems, and manipulators can perform these tasks with an accuracy and consistency that far exceeds human capability.
|
||||
|
||||
Sensing technologies are also very crucial in maintaining the safety and integrity of the reactor. They can include radiation detectors, temperature sensors, pressure sensors, fluid flow sensors, and material integrity sensors to monitor different state conditions within the reactor.
|
||||
|
||||
The integration of such technologies must be carefully engineered to handle the conditions present in a reactor, including high radiation, extreme temperatures, and potentially corrosive environments. Moreover, these systems must be capable of autonomous or semi-autonomous operation due to the remote and inaccessible nature of their work environment.
|
||||
|
||||
Additionally, advanced algorithms and communication protocols must be developed to handle the large volumes of data gathered by these systems, allowing for real-time monitoring, decision-making, and control of the reactor.
|
||||
|
||||
By integrating these technologies into nuclear breeder reactor design, it is possible to significantly increase operational safety, efficiency and longevity, while simultaneously reducing the risk to human personnel.
|
||||
|
||||
#### Question:
|
||||
|
||||
How can the principles of robotics and artificial intelligence be leveraged to develop autonomous systems that can effectively manage and mitigate potential nuclear accidents in breeder reactors, ensuring the safety of both the facility and surrounding environment?
|
||||
|
||||
#### Answer:
|
||||
|
||||
The development of autonomous systems to manage and mitigate potential nuclear accidents in breeder reactors would be multifaceted, relying on advancements in several areas, from sensing and perception, decision making, to physical execution, all under the principles of robotics and artificial intelligence.
|
||||
|
||||
**Sensing and Perception:** Advanced sensors and AI-driven perception systems can be used to continuously monitor the condition of the reactor in real-time. They can collect data on various parameters such as temperature, pressure, radiation levels etc, and use machine learning algorithms to detect anomalies or recognize patterns indicative of a potential accident.
|
||||
|
||||
**Decision Making:** If an anomaly is detected, an AI system, leveraging robotics and controls principles, can be used to determine the best course of action. It might involve a combination of predictive modeling (to forecast the evolution of the accident), optimization (to determine the action that minimizes the impact), and decision theory (to handle uncertainty and make decisions under risk).
|
||||
|
||||
**Physical Execution:** Autonomous robots, designed to withstand harsh environments (like high temperature and radiation), can be utilized to carry out tasks such as repairing faults, shutting down systems, or applying cooling mechanisms. Such robots should possess advanced locomotion capabilities to navigate complex structures, and manipulation capabilities to handle tools and perform delicate operations.
|
||||
|
||||
**Learning and Adaptation:** Once an incident has been managed, machine learning methods can be used to learn from the incident, and update the models or decision-making algorithms accordingly. This ensures that the system gradually becomes better at preventing and responding accidents.
|
||||
|
||||
With the integration of these technologies, it's possible to have an autonomous system that can effectively manage and mitigate potential nuclear accidents, thereby enhancing the safety of nuclear breeder reactors and reducing risks for human personnel.
|
||||
|
||||
#### Question:
|
||||
|
||||
How can we optimize the integration of renewable energy sources with nuclear breeder reactors to create a sustainable and resilient energy system for the future?
|
||||
|
||||
#### Answer:
|
||||
|
||||
Optimizing the integration of renewable energy sources with nuclear breeder reactors requires strategic planning, smart grid technologies, and sophisticated energy management systems. The following steps might be considered:
|
||||
|
||||
1. **Diversifying Energy Sources**: Rather than relying entirely on nuclear breeder reactors, an energy system including various renewable sources like solar, wind, hydro, and bio-energy, can ensure continuous power supply and make the system more resilient to the unpredictability of certain renewables.
|
||||
2. **Advanced Energy Storage Solutions**: Energy storage technologies like supercapacitors, flywheels, and advanced battery systems can store excess power produced during periods of low demand or high renewable generation and release it during peak demand or when renewable generation is low. This can help balance the load between nuclear and renewable sources effectively.
|
||||
3. **Smart Grid Technologies**: Smart grids can optimize energy flow, manage demand responses, and improve overall grid reliability. Real-time monitoring of both supply and demand can help to properly allocate power produced from different sources.
|
||||
4. **Advanced Energy Management Systems**: These systems use machine learning and artificial intelligence algorithms to optimize power generation, transmission, and distribution from diverse energy sources. They continually monitor and predict power load, weather conditions, and grid status to adjust the operation of the system in real time.
|
||||
5. **Grid Flexibility and Interconnections**: Strengthening the connectivity of the grid and enhancing its ability to flexibly respond to fluctuations, can enable the optimized use of varying power sources. This can be achieved through the use of virtual power plants and energy hubs.
|
||||
6. **Policy and Regulation**: Formulating and implementing appropriate policies and regulations to manage investment risks, power purchase agreements, and grid management can accelerate the integration of renewables with nuclear breeder reactors.
|
||||
|
||||
Please note that each solution also comes with potential challenges that need to be addressed. For example, a storage solution must take into account the costs associated, renewables' intermittency can risk grid stability, and policy-related factors depend heavily on the specific political, social, and economic conditions of the area where the system is implemented.
|
||||
|
||||
#### Question:
|
||||
|
||||
How can we design an integrated energy grid that incorporates advanced energy storage technologies and utilizes machine learning algorithms to efficiently balance the intermittent nature of renewable energy sources with the constant baseload power provided by nuclear breeder reactors?
|
||||
|
||||
#### Answer:
|
||||
|
||||
Designing an integrated energy grid that incorporates advanced energy storage technologies and utilizes machine learning algorithms to balance the intermittent nature of renewable energy sources requires several steps:
|
||||
|
||||
1. **Energy Storage**: We need to integrate advanced energy storage technologies like batteries, flywheels, pumped hydro storage, and thermal energy storage. These technologies can store excess energy generated during periods of low demand and deliver it during times of high demand.
|
||||
2. **Smart Grid**: An intelligent and smart grid system is required to manage and control the flow of electricity to ensure it gets delivered from the point of generation to the end consumers efficiently and effectively. This includes implementing automation, machine learning, real-time monitoring, and predictive modeling to control the power flow, detect faults, and respond to power outages.
|
||||
3. **Machine Learning Algorithms**: Advanced machine learning algorithms can be leveraged to analyze real-time data from various energy sources, forecast energy demand and supply, and make intelligent decisions on how to balance them. For instance, they can be used to optimize when to store energy, when to release it, and how to distribute it across the grid.
|
||||
4. **Demand Response Management**: Implementing demand response management systems that respond to changes in the price of power supply can also be a way to align demand with supply. With the help of IoT devices and smart meters, consumers can be encouraged to shift their use of electricity to times when the cost is lower, which often corresponds to when the supply is abundant.
|
||||
5. **Interconnecting Networks**: Enhancing the interconnectivity of electricity networks can allow for efficient balancing of power supply and demand over a larger geographical area, as a surplus in one region can compensate for a deficit in another.
|
||||
6. **Flexible Baseload Power**: Nuclear breeder reactors have the potential to provide a steady, constant supply of power. However, flexibility in their operation can be increased to complement the nature of renewable energy supplies. For instance, the output power from these reactors can be lowered during periods of high renewable energy generation and increased when renewable energy generation is low.
|
||||
|
||||
These integrated approaches combined can potentially create a highly efficient, resilient, and sustainable energy system for the future.
|
||||
|
||||
#### Question:
|
||||
|
||||
What novel advancements in materials science and engineering can be explored to improve the efficiency and longevity of nuclear breeder reactors, while minimizing the use of rare earth elements?
|
||||
|
||||
#### Answer:
|
||||
|
||||
Improving the efficiency and longevity of nuclear breeder reactors, and minimizing the use of rare earth elements can be achieved by exploring the following advancements in materials science and engineering:
|
||||
|
||||
1. **High-temperature Materials:** The efficiency of nuclear reactors can be improved by using materials that can withstand high temperatures without degradation. The higher the operating temperature of a reactor, the higher its thermodynamic efficiency. Materials like High-Entropy Alloys (HEAs) and ceramic composites (Silicon carbide-SiC) which have high heat resistance could be potential candidates.
|
||||
2. **Corrosion-resistant Materials:** The longevity of the reactor can be improved by using corrosion-resistant materials. Materials such as Ni-based superalloys and corrosion resistant coatings may play a critical role in this area.
|
||||
3. **Advanced Fuel Cladding Materials:** The cladding is the first layer of defense in preventing the release of radiation from the reactor. Materials with greater burnup capability, such as advanced steels or alloys, can reduce the use of fuel over the reactor's lifetime.
|
||||
4. **Materials for Coolants:** Improved coolants such as liquid metals (like sodium, lead or a lead-bismuth eutectic) or gases (like helium) could be used. These coolants can operate at high temperatures without the high pressures required by water coolants, improving efficiency and safety.
|
||||
5. **Neutron Economy:** Regarding the reduction of rare earth elements usage, replacing them with neutron efficient materials in the reactor designs could be done. Thorium, for example, is much more abundant and could be a suitable substitute in some breeder reactor designs.
|
||||
6. **Reducing and Recycling Waste:** Lastly, research is being done into how nuclear waste can be recycled into usable fuel, thereby reducing the need for fresh fuel.
|
||||
|
||||
Advanced computational techniques and simulations are being used to predict the behavior and performance of these new materials under the extreme conditions within a reactor. However, all these materials must undergo rigorous testing and verification before they can be used in a working reactor.
|
||||
|
||||
#### Question:
|
||||
|
||||
Can we develop new materials that exhibit high radiation resistance, thermal conductivity, and stability under extreme conditions, while also being more environmentally friendly and sustainable than current materials used in nuclear breeder reactors?
|
||||
|
||||
#### Answer:
|
||||
|
||||
Advancements in materials science and engineering are key to addressing this question. Scientists are exploring several avenues in the development of such materials.
|
||||
|
||||
1. **High-entropy alloys (HEAs)**: These are substances composed of multiple principal elements mixed in similar proportions, known for their high strength, ductility, and resistance to wear and deformation, making them potentially suitable for reactor applications.
|
||||
2. **Ceramic composites**: Certain ceramics and composite materials exhibit high thermal stability and resistance to radiation damage. Silicon carbide composites are one such example.
|
||||
3. **Metallic glass**: These are metallic materials with disordered atomic-scale structure. They possess unique properties such as high strength and toughness, and good corrosion and wear resistance, potentially making them ideal for use in harsh environments such as nuclear reactors.
|
||||
4. **Nanostructured materials**: These materials, engineered at the atomic or molecular level, can have unique properties like high strength and good radiation resistance that can be exploited.
|
||||
5. **Self-healing materials**: These materials can automatically repair damage caused by radiation, improving their lifetime and reducing waste.
|
||||
6. **Refractory metals and alloys**: These are a class of extraordinarily resistant materials – such as tungsten and its alloys – that could potentially be used.
|
||||
|
||||
The ultimate goal would be to design a material that integrates the beneficial properties of each type for use in nuclear reactors. However, this is still an active area of research, and the practical implementation of such materials on a large scale has yet to be fully realized. Furthermore, the environmental impact and sustainability of these materials need to be fully evaluated. More research and scientific breakthrough will be needed to develop such materials.
|
||||
|
||||
#### Question:
|
||||
|
||||
How can we utilize nanotechnology to design and engineer advanced coatings and materials that can enhance the radiation resistance and thermal conductivity of nuclear breeder reactors, while also reducing the cost and environmental impact of their production and maintenance?
|
||||
|
||||
#### Answer:
|
||||
|
||||
Nanotechnology has the potential to significantly enhance the properties of materials used in nuclear breeder reactors. For example, the use of nanostructured materials, which have a high proportion of atoms at grain boundaries, could increase radiation resistance, since these boundaries can act as sinks for radiation-induced defects.
|
||||
|
||||
Furthermore, nanoparticles can be incorporated into fuel or structural materials to enhance their properties. One example is the dispersion of oxide nanoparticles in fuels, which can lead to increased thermal conductivity and burnup, and reduced swelling.
|
||||
|
||||
Nanocoatings can also be used to create a barrier between the fuel and the reactor coolant, reducing the release of fission products into the coolant and potentially extending the life of the fuel.
|
||||
|
||||
However, employing nanotechnology in reactor materials also presents challenges. The stability of nanostructures under irradiation and high temperatures is not fully understood, and the fabrication of nanoparticulate fuels or materials at a large scale remains a technical challenge.
|
||||
|
||||
Research is ongoing in this space to better understand these materials and their potential benefits and drawbacks. Scientists use advanced modeling and experimental tools to understand the behavior of these materials under the extreme conditions inside a reactor, aiming to design advanced nanostructured materials that can safely and effectively be used in nuclear breeder reactors.
|
||||
|
||||
#### Question:
|
||||
|
||||
How can advances in quantum computing and simulation techniques be employed to accelerate the discovery and development of novel materials for use in next-generation nuclear breeder reactors?
|
||||
|
||||
#### Answer:
|
||||
|
||||
The potential of quantum computing in discovering and developing novel materials is massive. Quantum computers use the principles of quantum mechanics to process information. They can model and simulate the behavior of materials at an atomic and subatomic level, which is beyond the capacity of classical computers.
|
||||
|
||||
By using quantum computing, scientists can virtually experiment with the properties and structures of new materials. This simulation approach can significantly cut down the trial-and-error part in the laboratory, reduce costs, and accelerate the material discovery process. For instance, in the context of nuclear breeder reactors, quantum computing could allow us to model and test the behavior of potential new fuels and structural materials under extremely high temperature and radiation conditions.
|
||||
|
||||
Moreover, quantum computation can facilitate the design of materials with improved characteristics such as higher radiation resistance, better thermal conductivity, or optimized neutron economy, which could significantly enhance the efficiency and safety of nuclear breeder reactors.
|
||||
|
||||
However, it's important to note that although the potential is huge the quantum computing is currently in the development stage and it could take years or even decades before we see practical, wide-scale deployments in material science or other fields. The algorithms, error correction techniques, and hardware technologies for quantum computing are ongoing areas of research.
|
||||
|
||||
#### Question:
|
||||
|
||||
How can we harness the principles of quantum mechanics to design materials that can withstand the extreme conditions of nuclear breeder reactors, maximizing their efficiency and minimizing the production of radioactive waste?
|
||||
|
||||
#### Answer:
|
||||
|
||||
Quantum mechanics, as a fundamental theory in physics, provides a deep understanding of how particles like electrons and nuclei interact and behave. This knowledge can be harnessed in the design of materials for nuclear applications. Quantum mechanics principles can be utilized to understand material behavior at an atomic and molecular level.
|
||||
|
||||
Firstly, the principle of quantum superposition can allow us to predict the properties of materials under various conditions. For instance, quantum superposition could potentially enable the prediction of material behaviors under the high pressures and temperatures found inside a nuclear breeder reactor.
|
||||
|
||||
Secondly, quantum tunneling, another principle of quantum mechanics, might be utilized to improve the efficiency of nuclear reactions. Moreover, the principle of quantum entanglement could potentially be employed to make processes inside the reactor more controllable, which would lead to enhanced safety.
|
||||
|
||||
Thirdly, the study of quantum dots and other nanoscale materials could lead to advancements in radiation-resistant materials. These materials could potentially better withstand the harsh environment inside a nuclear reactor, thus increasing the reactor's lifespan and safety.
|
||||
|
||||
Quantum mechanics is a rapidly evolving field and its application in the realm of material science is still in its infancy. But its potential applications in designing and developing new materials for nuclear reactors seem promising. It's worth noting, however, that these are theoretical possibilities and more concrete results would require extensive research and experiments.
|
||||
|
||||
#### Question:
|
||||
|
||||
How can we optimize the interaction between quantum materials and nuclear breeder reactor systems to achieve unprecedented levels of energy efficiency and safety?
|
||||
|
||||
#### Answer:
|
||||
|
||||
Nuclear breeder reactors, due to their unique working principle, typically work at very high energy scales which is comparable to atomic scales. At these scales, quantum mechanical effects become significant. Optimizing the interaction between quantum materials and nuclear breeder reactor systems would require a solid understanding of quantum mechanics and statistical mechanics.
|
||||
|
||||
One possible approach to optimize the interaction might be to design materials with quantum properties that can withstand high temperature and pressure by taking into account quantum confinement and quantum exchange interaction. This could potentially increase the stability of the material under extreme conditions.
|
||||
|
||||
Another possible application of quantum materials is creating superconducting shields that might aid in the heat generation or transportation process, while also providing superior radiation absorption or shielding against neutrons generated in the reactor.
|
||||
|
||||
However, these topics are currently at the forefront of research and are fairly theoretical at the moment. They are not yet mature enough for industrial application, and a lot of work is still required to understand the practical intricacies of harnessing quantum principles in these scenarios.
|
||||
|
||||
#### Question:
|
||||
|
||||
How can we leverage advanced nanoscale engineering techniques to design materials with tailored quantum properties for use in nuclear breeder reactors?
|
||||
|
||||
#### Answer:
|
||||
|
||||
Advanced materials for nuclear breeder reactors can be developed by leveraging nanoscale engineering techniques to design materials with tailored quantum properties.
|
||||
|
||||
For example, quantum dots, which are nanoscale particles, can be engineered to have specific properties such as a specific band gap or optical properties. These can be used to enhance the efficiency of energy capture and conversion in nuclear reactors.
|
||||
|
||||
Similarly, materials with engineered nanostructures can be used to enhance thermal conduction and radiation resistance, thereby improving the safety and longevity of nuclear reactors. For example, nanocomposite materials containing high thermal conductivity nanoparticles can be used to enhance heat transfer. Meanwhile, nanolaminates can be utilized to provide high radiation resistance.
|
||||
|
||||
To achieve such advanced control over material properties, one can apply techniques from quantum physics and nanotechnology, such as quantum confinement and top-down or bottom-up nanofabrication. These allow us to precisely control the size, shape, composition, and arrangement of nanoparticles or nanostructures, tailoring the material’s response to nuclear environments.
|
||||
|
||||
Overall, the design of materials with tailored quantum properties using nanoscale engineering techniques could play a crucial role in improving the performance, safety, and sustainability of nuclear breeder reactors.
|
||||
|
||||
#### Question:
|
||||
|
||||
What are the potential implications and challenges of integrating quantum computing technologies into the control and optimization systems of nuclear breeder reactors?
|
||||
|
||||
#### Answer:
|
||||
|
||||
Quantum computing technologies have the potential to significantly enhance the control and optimization systems of nuclear breeder reactors due to their ability to process vast amounts of information and solve complex problems much quicker than traditional computing technologies. They could be utilized to model and simulate the behavior of the reactor core, optimize fuel use, monitor system performance, and predict potential faults or failures, among other things.
|
||||
|
||||
However, integrating quantum computing technologies into nuclear breeder reactors is not without its challenges. Firstly, quantum computers are highly sensitive to environmental disturbances, meaning that they need to be isolated from any external noise or interference. This presents a significant challenge in the context of a nuclear breeder reactor, which operates under extreme conditions of heat, radiation, and pressure.
|
||||
|
||||
Secondly, quantum computing is a very new and rapidly-evolving field, and there is still much to be learned about how to best utilize and manage these systems. This includes not only technical issues such as error correction and system optimization, but also broader logistical and regulatory issues.
|
||||
|
||||
Thirdly, there are also important security considerations to take into account when integrating quantum computing technologies into nuclear systems, given the potential for cyber-attacks that could compromise system integrity and safety.
|
||||
|
||||
Lastly, implementing quantum computing technologies would involve a significant investment in terms of both the technology itself and the necessary infrastructure and expertise to support it. This could be a barrier for some organizations, particularly in the public sector where budgets may be constrained.
|
||||
|
||||
Therefore, while the potential benefits of integrating quantum computing technologies into nuclear breeder reactors are substantial, these challenges need to be carefully considered and addressed.
|
||||
|
||||
#### Question:
|
||||
|
||||
How can we leverage quantum computing to enhance the accuracy and efficiency of nuclear waste management strategies, ensuring long-term containment and minimizing environmental impact?
|
||||
|
||||
#### Answer:
|
||||
|
||||
#### Question:
|
||||
|
||||
How can we leverage nanotechnology and advanced materials to develop efficient and sustainable methods for the safe storage and disposal of nuclear waste?
|
||||
|
||||
#### Answer:
|
||||
|
||||
Nanotechnology and advanved materials can play a significant role in improving the efficiency of nuclear waste disposal methods and the sustainability of nuclear power generally.
|
||||
|
||||
Firstly, nanomaterials can be used to enhance the efficiency of nuclear waste storage. An example are zeolites, a class of microporous minerals. Due to their larger surface-to-volume ratio, zeolites are capable of trapping and containing nuclear isotopes more efficiently than traditional materials.
|
||||
|
||||
Secondly, advanced materials such as borosilicate glass and synthetic rock have been used to immobilize nuclear waste. In a process known as vitrification, high-level waste is combined with glass-forming materials and heated until it melts and then cooled to form a solid, stable glass block. This method helps to contain the radioactivity and prevents leaching.
|
||||
|
||||
Other research is looking at encapsulating waste in synthetic rock. This waste form, known as Synroc, contains several titanate minerals which are capable of immobilizing the problematic components of nuclear waste.
|
||||
|
||||
Lastly, nanotechnology can also be used to reduce the volume of nuclear waste. A common approach is by using nanoparticles as absorbents or membranes that can effectively separate the radioactive elements from the waste.
|
||||
|
||||
However, these applications also come with challenges such as ensuring the long-term stability of these nanomaterials and advanced materials, as well as their resistance to radiation damage.
|
||||
|
||||
Developments in this field require interdisciplinary collaboration among nuclear physicists, materials scientists and engineers, and environmental scientists to ensure the safe and sustainable implementation of these technologies.
|
||||
|
||||
#### Question:
|
||||
|
||||
How can we utilize advanced materials and technologies to develop innovative strategies for the reprocessing and recycling of nuclear waste, thereby minimizing its long-term environmental impact and maximizing the potential for resource utilization?
|
||||
|
||||
#### Answer:
|
||||
|
||||
#### Question:
|
||||
|
||||
How can we develop advanced nuclear fuel cycles that optimize energy production, reduce waste generation, and minimize the proliferation risks associated with nuclear breeder reactors?
|
||||
|
||||
#### Answer:
|
||||
|
||||
Comprehensive optimization of advanced nuclear fuel cycles in breeder reactors involves a multi-pronged approach:
|
||||
|
||||
1. **Fuel Efficiency**: One of the most important goals is to improve fuel efficiency by designing and formulating fuels that can bear high burnup rates. This means creating fuel that can stay in the reactor longer, thereby extracting as much energy as possible from the nuclear material.
|
||||
2. **Waste Reduction**: This involves focusing on fuel reprocessing and recycling strategies. Breeder reactors are typically capable of using recycled fuel. This can include techniques like pyroprocessing and advanced aqueous processing.
|
||||
3. **Proliferation Resistance**: The fuel cycle must be designed to reduce the potential for proliferation. This means handling the materials such that it's difficult to divert them for non-peaceful uses. This can be accomplished by increasing the accountability, control, and safeguard measures during material processing.
|
||||
4. **Safety**: The fuel cycle needs to be inherently safe, so the processes involved in producing, using, and disposing of fuel should not bring about dangerous conditions.
|
||||
|
||||
The specific processes and technologies to achieve these goals will depend on the type of reactor and fuel. Constant research is going on in areas like novel fuel formulations and designs, advanced waste reprocessing methods, and effective safeguards and containment techniques that ensure safety and non-proliferation.
|
||||
|
||||
#### Question:
|
||||
|
||||
What novel strategies can be explored to achieve sustainable and efficient utilization of nuclear fusion as a potential alternative to nuclear fission in the context of breeder reactors?
|
||||
|
||||
#### Answer:
|
||||
|
||||
Nuclear fusion is a different process compared to nuclear fission used in breeder reactors. The key challenge in harnessing nuclear fusion is to maintain the conditions under which fusion can occur.
|
||||
|
||||
For a fusion reaction, fuel (usually isotopes of hydrogen) needs to be heated to very high temperatures (approximately 100 million degrees Celsius) to form a plasma where the atoms have enough energy to overcome their natural repulsion and collide, leading to fusion. This state also needs to be confined and controlled for a sustained period of time. These conditions are challenging to achieve and maintain, and current fusion experiments consume more energy than they produce.
|
||||
|
||||
However, scientific and technological advancements are being made to improve the efficiency and feasibility of nuclear fusion. Some of the strategies include:
|
||||
|
||||
1. Advanced Plasma Containment: Development of advanced magnetic confinement systems, like tokamaks and stellarators, that can effectively contain the plasma, maintaining the conditions for fusion.
|
||||
2. Alternative Fusion Methods: Exploration of alternative fusion methods, like inertial confinement fusion, which uses high-powered lasers to heat and compress the fuel.
|
||||
3. Advanced Fusion Fuels: Use of advanced fusion fuels like helium-3, which generates less neutron radiation compared to other fusion reactions.
|
||||
4. Advanced Materials: Development of materials that can withstand the harsh conditions inside a fusion reactor. These materials need to be resistant to high temperatures, high neutron radiation, and must also be able to efficiently transfer heat.
|
||||
5. Machine Learning and AI: These technologies can potentially be used to optimize the complex plasma dynamics inside a fusion reactor in real-time.
|
||||
6. Fusion-Fission Hybrids: Hybrid systems are being explored where fusion reactions are used to "breed" fissile material for use in conventional fission reactors, potentially improving the sustainability of nuclear energy.
|
||||
|
||||
The feasibility of these strategies is a subject of ongoing research. Despite many challenges, nuclear fusion holds great promise as a virtually limitless and clean source of energy. If successful, it could complement or even replace fission reactors, including breeder reactors, in the future.
|
||||
|
||||
#### Question:
|
||||
|
||||
How can we overcome the challenges of achieving sustained and controlled nuclear fusion reactions in order to harness its immense potential as a clean and virtually limitless source of energy?
|
||||
|
||||
#### Answer:
|
||||
|
||||
The challenges to achieving sustained and controlled nuclear fusion are large and multi-faceted, with key areas including plasma confinement, plasma heating, neutron damage and reaction byproduct handling among others.
|
||||
|
||||
1. Plasma confinement: Fusion reactions take place at extremely high temperatures, forming a state of matter termed as plasma. Keeping the plasma stable and confined without touching the walls of the reactor is crucial. Two common methods in use today are magnetic confinement and inertial confinement, using strong magnetic fields or high energy lasers respectively.
|
||||
2. Plasma heating: Adequate heating methods are crucial to maintain the high temperatures necessary for fusion reactions. This is often achieved through the use of high-frequency electromagnetic waves or neutral beam injection.
|
||||
3. Neutron damage: The fusion process releases high energy neutrons which can cause structural damage to the reactor materials, inducing radioactivity. Developing robust materials that can withstand these conditions is a significant challenge.
|
||||
4. Reaction byproduct handling: The fusion process generates byproducts including helium and neutron. Safe handling, extraction and disposal of these byproducts is another critical challenge.
|
||||
5. Achieving 'ignition': A point at which the fusion reactions produce enough heat to sustain further reactions without external heating input is termed as 'ignition'.
|
||||
|
||||
Overcoming these challenges would require further extensive research, innovative engineering solutions, advanced materials science, plasma physics, and many other areas of science and technology.
|
||||
|
||||
#### Question:
|
||||
|
||||
What are the current limitations and challenges in the development and implementation of nuclear fusion as a viable and sustainable energy source on a large scale?
|
||||
|
||||
#### Answer:
|
||||
|
||||
The main challenges and limitations in achieving nuclear fusion as a viable and large-scale source of energy are:
|
||||
|
||||
1. **Achieving and controlling high temperatures**: Nuclear fusion reactions require extremely high temperatures (in the order of millions of degrees Celsius) to overcome the natural repulsion between atomic nuclei. Designing materials and devices capable of withstanding these high temperatures and controlling the plasma at these temperatures is a major challenge.
|
||||
2. **Sustaining the fusion reaction**: For a fusion power plant to be viable, the fusion reaction must be sustained for a prolonged period. So far, it has been difficult to achieve this "ignition" where the fusion reaction is self-sustaining.
|
||||
3. **Net energy output**: So far, no experimental fusion reactor has been able to achieve a net energy gain, i.e., producing more energy through the fusion reaction than the energy used to start and maintain the reaction. This is a fundamental requirement that must be met for fusion to be a practical source of power.
|
||||
4. **Neutron radiation**: Fusion reactions generate high-energy neutrons, which can activate materials and make them radioactive. This poses challenges for materials design and reactor longevity.
|
||||
5. **Fuel supply**: While the fusion of deuterium and tritium is the easiest to achieve and has been the focus of most research, tritium is not readily available and needs to be bred from lithium in the reactor, adding a layer of complexity to the fusion fuel cycle.
|
||||
6. **Cost and resources**: Constructing a fusion reactor is a huge engineering challenge requiring significant resources. There is uncertainty whether fusion power can be economically competitive with other energy sources.
|
||||
7. **Nuclear waste**: Although fusion reactors produce less radioactive waste than fission reactors and the waste is less long-lived, the management of waste is nonetheless an important consideration.
|
||||
|
||||
Despite these challenges, advances in materials science, plasma physics, and engineering could eventually make nuclear fusion a viable energy source. Research in this field is ongoing and progress is being made, particularly with projects like the ITER fusion experiment in France.
|
||||
|
||||
#### Question:
|
||||
|
||||
What are the potential implications of harnessing nuclear fusion as a practical and abundant energy source for powering long-duration space exploration missions?
|
||||
|
||||
#### Answer:
|
||||
|
||||
Nuclear fusion has the potential to provide a nearly unlimited supply of energy with much less radioactive waste compared to nuclear fission. In the context of space exploration, if we can harness safe and controlled fusion reactions, it would be a game-changer.
|
||||
|
||||
Firstly, nuclear fusion could provide the high energy density required for long-duration space missions. A spacecraft powered by fusion energy could carry less fuel weight, which is a huge advantage given that fuel typically accounts for a large fraction of a spacecraft’s starting mass.
|
||||
|
||||
Secondly, nuclear fusion could also potentially power in-spacecraft systems for many years, even decades, providing long-term power generation.
|
||||
|
||||
Thirdly, in the farther future, if we could glean helium-3 (which is used in one type of fusion reaction) from lunar soil or the gas giants, it could potentially be used to fuel long-duration space missions.
|
||||
|
||||
However, despite its promise, nuclear fusion is currently not a viable power source for space missions. Challenges include the technology's immaturity, the difficulty of achieving a sustained and controlled fusion reaction, the large size and mass of current experimental fusion reactors, and the high costs and resources associated with fusion research and development. Nonetheless, given the theoretical potential, research in this area continues with the hope of overcoming these obstacles.
|
||||
|
||||
#### Question:
|
||||
|
||||
How can we optimize the design of advanced propulsion systems using nuclear fusion for interstellar travel, considering the challenges of energy generation, mass conversion, and containment?
|
||||
|
||||
#### Answer:
|
||||
|
||||
#### Question:
|
||||
|
||||
How can we overcome the immense distances and time scales involved in interstellar travel to enable the exploration and colonization of distant star systems with advanced propulsion technologies?
|
||||
|
||||
#### Answer:
|
||||
|
||||
Nuclear fusion, if harnessed, can potentially provide a high thrust-to-weight ratio and specific impulse, which are necessary parameters for considering propulsion in interstellar travel.
|
||||
|
||||
There are several concepts that pair fusion energy and propulsion, most notably the concept of a fusion rocket. This device uses the reaction energy produced by fusion to heat and expel a propellant, creating thrust. The key challenge here is to produce a controlled fusion reaction that can be sustained for the duration of the mission.
|
||||
|
||||
Then, there are more futuristic concepts like the "Daedalus" or "Icarus" interstellar spacecraft design proposals, which are essentially immense, unmanned fusion-driven vessels specifically designed for interstellar travel.
|
||||
|
||||
Finally, there is the idea of a fusion ramjet, where interstellar hydrogen is used as both the fusion fuel and reaction mass, keeping the vehicle's weight down. This again requires very advanced, yet-to-be-invented containment technologies.
|
||||
|
||||
But, all these concepts currently face significant technological hurdles and need many advancements in areas such as fusion technology, materials science, radiation shielding, fuel gathering and confinement methods, miniaturization, and more.
|
||||
|
||||
Nevertheless, the idea of using nuclear fusion for interstellar travel remains a major potential breakthrough that could revolutionize our approach to space travel and exploration. However, these are all still theoretical and research is ongoing. The distances and energy required for interstellar travel are immense, and even with optimal propulsion technologies like nuclear fusion, such missions would still likely take many decades or even centuries.
|
||||
|
||||
#### Question:
|
||||
|
||||
Is it possible to develop methods or technologies that can exceed the speed of light, allowing for near-instantaneous travel between star systems?
|
||||
|
||||
#### Answer:
|
||||
|
||||
As per our current understanding of physics and in accordance with Einstein's theory of relativity, it is not possible to travel faster than the speed of light in a vacuum, which is approximately 186,282 miles per second (299,792 kilometers per second). This speed limit is considered fundamental to the fabric of space-time itself.
|
||||
|
||||
As objects with mass accelerate towards the speed of light, their relativistic mass increases, which requires more energy to continue to accelerate. It would require an infinite amount of energy to accelerate an object with mass to the speed of light.
|
||||
|
||||
Moreover, faster than light travel could involve causality problems, the cause and effect principle, leading to scenarios such as time paradoxes, which contradict our current understanding of physics.
|
||||
|
||||
While there are some theoretical concepts such as wormholes and Alcubierre drives that may allow for faster than light "effective" travel by warping space-time, these concepts are currently not practically achievable and remain within the realm of speculative science.
|
||||
|
||||
However, this is based on what we currently understand about the laws of physics. Future research, advancements in technology, or groundbreaking theoretical developments may reshape these understandings.
|
||||
|
||||
#### Question:
|
||||
|
||||
Is it possible to manipulate spacetime and create a stable wormhole for instantaneous travel across vast cosmic distances?
|
||||
|
||||
#### Answer:
|
||||
|
||||
According to current knowledge and understanding of physics, particularly General relativity by Albert Einstein, creating a stable wormhole for instantaneous travel across vast cosmic distances remains speculative and highly theoretical. Wormholes are theoretical passage through space-time that could create shortcuts for long journeys across the universe. However, to keep the wormhole stable, it would require the existence of a substance with negative energy, often referred to as "exotic matter". But we do not currently have any experimental evidence to support the existence of such a substance.
|
||||
|
||||
Even if wormholes could be formed, there is the issue of stability. Current understanding suggest that any wormhole that could be formed would be extremely unstable, collapsing instantly after its formation. Some physicists proposed that "exotic matter" or energy with negative density relative to vacuum energy could theoretically be used to stabilize a wormhole, but such matter hasn't been found yet and its existence remains hypothetical.
|
||||
|
||||
Also, forming a wormhole may involve quantum-scale effects, which are not well understood in the context of strong gravitational fields, and there may be fundamental limitations imposed by quantum mechanics.
|
||||
|
||||
Therefore, at present, wormhole formation and use for travel remain speculative and are largely the domain of very high-level theoretical physics and science fiction.
|
||||
|
||||
#### Question:
|
||||
|
||||
What are the potential long-term effects of exposure to ionizing radiation in space on the health and well-being of astronauts during long-duration interplanetary missions?
|
||||
|
||||
#### Answer:
|
||||
|
||||
Ionizing radiation in space poses a serious risk to astronauts on long-duration missions. This is due to the presence of galactic cosmic rays (GCRs) and solar particle events (SPEs), which are composed of high-energy protons and heavy ions that can pass through the walls of spacecraft and human tissue, potentially causing significant damage.
|
||||
|
||||
The potential long-term effects of exposure to this type of radiation can include:
|
||||
|
||||
1. **Cancer**: Ionizing radiation can damage DNA, leading to mutations that can cause various types of cancer.
|
||||
2. **Central Nervous System Effects**: Studies have suggested that exposure to cosmic rays could have harmful effects on the brain, potentially impacting cognitive function, mood, and motor function.
|
||||
3. **Cardiovascular Disease**: There is growing evidence that radiation exposure may increase the risk of cardiovascular disease.
|
||||
4. **Degenerative Tissue Effects**: Degeneration of tissues, such as the skin, heart, and the lenses of the eyes, can be caused by radiation exposure. This could potentially lead to diseases such as cataracts, heart disease, and other age-related conditions.
|
||||
5. **Acute Radiation Syndrome (ARS)**: In the event of a large solar particle event (SPE), astronauts could potentially be exposed to very high doses of radiation, leading to ARS, which could cause nausea, fatigue, loss of white blood cells, and even death in very severe cases.
|
||||
|
||||
It is important to note that much of our understanding of radiation risks comes from studies of populations on Earth exposed to radiation, and there is still much we do not understand about the health risks associated with space radiation. As a result, reducing astronaut exposure to radiation, through improved spacecraft shielding, mission planning, and potential future medical interventions, is a key area of research for long-duration interplanetary missions.
|
||||
|
||||
#### Follow-up Questions.
|
||||
|
||||
* What are the potential implications and challenges of utilizing advanced quantum teleportation techniques for near-instantaneous communication across astronomical distances?
|
||||
* What are the potential implications of quantum entanglement for secure and unbreakable communication channels in the context of interstellar space missions?
|
||||
* How can we harness the principles of quantum mechanics to develop quantum computing systems that can efficiently simulate and optimize complex quantum systems, such as nuclear breeder reactors, on a large scale?
|
||||
* How can we leverage the principles of quantum entanglement to develop new methods for the efficient transfer of energy in quantum systems?
|
||||
* What are the potential implications of harnessing quantum entanglement for secure quantum communication networks on a global scale?
|
||||
* What are the potential strategies and technologies that can be employed to mitigate the harmful effects of ionizing radiation on astronauts during long-duration space missions?
|
||||
* What are the potential biological and genetic adaptations that could occur in future human populations living in space colonies or on other planets, given the unique radiation environments and microgravity conditions?
|
||||
* What are the potential implications of extended space travel on the neurological and cognitive functions of astronauts, and how can we mitigate any negative effects?
|
||||
* What are the potential long-term effects of microgravity on the human immune system, and how can we develop countermeasures to maintain optimal immune function during space travel?
|
||||
* How can we optimize the design of artificial gravity systems to mitigate the negative effects of prolonged exposure to microgravity on the human body?
|
||||
13
content/archive/2024-07-17-operating-personal-as.md
Normal file
13
content/archive/2024-07-17-operating-personal-as.md
Normal file
@@ -0,0 +1,13 @@
|
||||
---
|
||||
title: Operating personal AS
|
||||
date: 2024-07-17T01:11:00.000Z
|
||||
---
|
||||
### AS214578
|
||||
|
||||
I am operating small network of AS214578, with few IPv6 spaces only.
|
||||
|
||||
I acquired it from RIPE, which is relatively easy to work with. It costs about 100EUR/year for ASN and 80EUR/yr for /44 IPv6 Addresses.
|
||||
|
||||
You can request IP resources seperately from who sponsors ASN, so I can get ASN from some provider who provides it at cheap and IPv6 from other provider who provides it at cheap.
|
||||
|
||||
I have no idea I could ever use this resource useful enough for the money.
|
||||
0
content/archive/_index.md
Normal file
0
content/archive/_index.md
Normal file
23
content/blog/1970-01-01-notes-abiapi.md
Normal file
23
content/blog/1970-01-01-notes-abiapi.md
Normal file
@@ -0,0 +1,23 @@
|
||||
---
|
||||
title: Notes - 4. A*I
|
||||
date: 1970-01-01T00:00:00.000Z
|
||||
---
|
||||
|
||||
### 4. ABI?
|
||||
|
||||
For me it wasnt clear enough about definition of ABI.
|
||||
|
||||
Application Binary Interface. Defines how data structures from machine code. System library / binary compatability. e.g. Data Type, Size, Layout, Alignment, ..
|
||||
|
||||
1. In Linux, `struct dirent{}` and corresponding of other OS differ. It is data structure mismatch, which is part of ABI. Also, typing like int, long may be 32bits, 64bits,,, though it usually doesnt differ in modern system.
|
||||
2. Alignment of memory.
|
||||
3. Calling convention ... How argument is passed. Via "eax, ebx, ecx..." or in stack? and also return values.
|
||||
- System ABI, syscalls? ... syscall "int 0x80" is Linux's own ABI. Where is argument, syscall type indication where?
|
||||
- Object code, shared libraries. ... Function call conventions, naming convention for shared object, may differ and thus mismatch?
|
||||
1. Binary object format, ELF, PE, Mach-O is also part of ABI.
|
||||
2. glibc, musl, ... this libc mismatch is also part of ABI incompatibility. Function signatures, syscall wrappers, symbol versioning, ...
|
||||
|
||||
API is just defining high-level approach of data exchange, ABI is more lower level approach of binary applications talk to each other via binary data structures and object conventions.
|
||||
|
||||
API read(fd, mode, bytes) can be same but where parameter is passed (in ASM level) may differ.
|
||||
|
||||
65
content/blog/1970-01-01-notes-dbus.md
Normal file
65
content/blog/1970-01-01-notes-dbus.md
Normal file
@@ -0,0 +1,65 @@
|
||||
---
|
||||
title: Notes - 3. DBus
|
||||
date: 1970-01-01T00:00:00.000Z
|
||||
---
|
||||
|
||||
### 3. D-Bus?
|
||||
|
||||
D-Bus is IPC system for Linux, it provides structualized way for apps to communicate with each other.
|
||||
|
||||
Desktop Bus System.
|
||||
|
||||
System-bus and session-bus
|
||||
|
||||
System services <-> root application / system users.
|
||||
|
||||
- Hardware events, system state managing, low-levels
|
||||
|
||||
User session <-> user applications and users.
|
||||
|
||||
- Desktop Environment, Apps.
|
||||
|
||||
=> Event-driven communication / Object-oriented
|
||||
|
||||
Messaging. - calls / returns / error / signal
|
||||
|
||||
Object - interface -> method -> property -> signal
|
||||
|
||||
Method = (call, return, error, signal)
|
||||
|
||||
D-Bus router = message broker / router (just like other message forward/proxy protocols)
|
||||
|
||||
Method Calls -> request of service? RPC?
|
||||
|
||||
Signals. kernel signal in userspace. send signal to application.
|
||||
|
||||
Objects .. Message = Serialized bytearray of any signal / method calls. It is like RPC. Multi-multi RPC-bus
|
||||
|
||||
D-Bus Message structure.
|
||||
|
||||
Byteorder / Message Type / Flags / Protocol Version / Length / UUID / Header / Body.
|
||||
|
||||
How and where can I use D-Bus in my application?
|
||||
|
||||
Communication with low-level D-Bus daemon(server).
|
||||
|
||||
Ex. MediaPlayer - Implement Play/Pause/Stop/Volume for user to control via DE's common interface i.e. play button on taskbar? Extensions? Anyway structulized way of control.
|
||||
|
||||
Ex. DE can get information about songs now playing, via D-Bus.
|
||||
|
||||
Ex. System monitoring application e.g. runCat.
|
||||
|
||||
Ex. Caffeine-ng -> prevents machine from sleeping.
|
||||
|
||||
Ex. Solaar -> Controls mouse/keyboard in low-level. Needs D-Bus.
|
||||
|
||||
How?
|
||||
|
||||
Define D-Bus interface via XML, signals. methods, props. (export to bus?) -> Implement by library -> Connect to D-Bus (sync with daemon?) -> Do something.
|
||||
|
||||
Session vs System D-Bus
|
||||
|
||||
Session ? e.g. Push notification to DE. we need to send it via d-bus.
|
||||
|
||||
System ? e.g. Power Event, kernel-level type of event managing.
|
||||
|
||||
92
content/blog/1970-01-01-notes-drivers.md
Normal file
92
content/blog/1970-01-01-notes-drivers.md
Normal file
@@ -0,0 +1,92 @@
|
||||
---
|
||||
title: Notes - 5. Drivers
|
||||
date: 1970-01-01T00:00:00.000Z
|
||||
---
|
||||
|
||||
### 5. Linux Kernel's Driver Management
|
||||
|
||||
< Android HAL >
|
||||
|
||||
Android. HAL (Hardware Abstraction Layer) Why? Linux kernel already includes a lot of driverset, why additional userspace device driver manager is needed?
|
||||
|
||||
Android can be configured by a lot different parts, compared to PC or server. Like lte modem, wifi chip, screen chip, etc. Linux's mainline kernel cant manage all this many chips.
|
||||
|
||||
Its like alternative universal driver package. Variety of hardware config, but allow modular and consistent interface. (In Linux world, there are also Abstract Layers like HAL, like ALSA/PA or libinput or even FUSE is Abstract layer if you wanna say so...)
|
||||
|
||||
Its bridge between hardware driver and Android Framefork layer, and Android Framework driver provides universal interface. Android Apps can use those peripherals through standardized Android API (like Camera API or sensors, GPS..). Hardware vendors makes API driver? (can we say that's server?) from their hardware to Android Manger class.
|
||||
|
||||
### **Linux Userspace Driver**
|
||||
|
||||
"Userspace Driver."
|
||||
|
||||
- Different from non-mainline kernel drivers, these are done as 3rd party kernel modules or patches, not userspace drivers.
|
||||
|
||||
- Userspace driver needs context-switching (unline kernel driver), so more overhead.
|
||||
|
||||
How exactly userspace drivers can access and use physical peripherals? Peripherals usually use "cpu port" in x86, and "memory map" in ARM. Unlike kernel that actually can access these without any restrictions, they somehow need to access to raw port or raw memory.
|
||||
|
||||
UIO (Userspace I/O)
|
||||
|
||||
- Allows userspace apps to directly access hardware devices and handle interrupts.
|
||||
|
||||
- Kernel module is paired with userspace component to do kernel jobs like things above. Its like proxy.
|
||||
|
||||
MMIO (Memory-Mapped I/O)
|
||||
|
||||
- For memory-mapped register, userspace app can access device's memory after mapped with mmap() syscall.
|
||||
|
||||
- Q. Accessing arbitary raw memory addresses without MMU protection is restricted, isnt it?
|
||||
|
||||
- A. mmap() allows userspace program to map specific portion of memory into its own address space.
|
||||
|
||||
or, map hardware register's address into specific userspace virtual address.
|
||||
|
||||
### Drivers and CPU Peripherals
|
||||
|
||||
CPU has its own preconfigured ports (or pins), e.g. PCI, USB, and I/O buses like SPI or I2C. Signal through this pins are handled by CPU as the part of SoC. If we take a look at CPU's datasheet, we can see how pins are assigned for specific signals. CPU pins are assinged to RAM-related pins, JTAG, GPIO, PCIe, I2C, UART, SPI, and so on. Beside complex I/O like USB, PCIe, SATA that requires high datarate and strict signal timing, less complex I/O like UART or I2C can use GPIO pins for communication. GPIOs are versatile and can be programmed to communicate with various interfaces. This way of using software instead of dedicated hardware is called "bit banging", and we can easily see this on like Arduino.
|
||||
|
||||
But there arent many interfaces that doesnt requires strict timing, only UART or basic I2C can be bit-banged. In most time, dedicated controller hardware is required. These hardware blocks can handle the timing and electric signals or even validation of data, thus ensures higher throughput and reliability.
|
||||
|
||||
CPU has limited amount of pins, and we need to connect tremendous amount of devices. External hardware controllers and buses are required to expand I/O. These controllers can often interface with many devices on the same bus (like multiple SPI or I2C devices) and serialize the communications.
|
||||
|
||||
Serialization is the key of efficient communication. CPU technology is eveolved, and we can use very high speed buses. With these high-speed buses serial communication has advantage over paralell communication, which was primarily used when we only had low-speed buses.
|
||||
|
||||
Well, there was northbridge and southbridge long CPU ago, CPU needed additional chipset for all high speed interface, like RAM or PCIe. Then northbridge is directly connected to CPU via "Front side bus". {{ }} .
|
||||
|
||||
Currently, just those bridges are integrated into CPU as SoC] or just one chipsets. Those chipsets connects to CPU as PCIe.
|
||||
|
||||
During the boot process, the OS will initialize MMU, but in early stage of booting, the CPU may operate in a mode where the MMU in not yey enabled or is configured to provide a direct mapping, so that kernel can to permissive tasks. Once OS is loaded, is first sets up MMU with kernel's own memory mapping setup, and also necessary permissions among address spaces.
|
||||
|
||||
In case of MMIO, OS will configure MMU to create direct mapping between requesting process's VA space and device's physical address that its register mapped into. Also disabling CPU caching is done for this address range.
|
||||
|
||||
So, How does OS configure MMU?
|
||||
|
||||
1. Setting up page tables: The OS creates and populates page tables that define the mapping between virtual and physical addresses.
|
||||
|
||||
2. Configuring control registers: The OS sets specific CPU control registers to enable the MMU and define its behavior.
|
||||
|
||||
3. Flushing TLB: After making changes, the OS flushes the Translation Lookaside Buffer (TLB) to ensure the new mappings take effect.
|
||||
|
||||
4. Setting up memory attributes: The OS configures memory attributes for different regions, such as cacheability, executability, and access permissions.
|
||||
|
||||
5. Handling exceptions: The OS sets up handlers for page faults and other memory-related exceptions.
|
||||
|
||||
- libusb?
|
||||
|
||||
userspace USB comm without kernel things, FUSE allows userspace filesystem.
|
||||
Interact directly with hardware or implement file systems without requiring kernel-level drivers.
|
||||
|
||||
- ioctl calls?
|
||||
|
||||
Communicating with device drivers?
|
||||
Allows user-space programs -> device-specific command to drivers? query device status? (anyway which isnt read/write)
|
||||
|
||||
### Linux's driver problem
|
||||
|
||||
- Peripherals are growing exponentially, even Embedded controller itself is also many. If Linux kernel supports them all, it will be so big, even with kernel modules. Large scale makes system unstable. With this in mind, I think switching drivers from kernel-space-large-codebase-driver to userspace modular and seperate driver managing is better. Also Linux kernel's driver isnt equally supported in mainline. They hates merging propriety drivers, even though it is important to include it for user experience.
|
||||
- Linux's Monolithic Kernelspace Driver managing .. Security, Performance, Reusability, it is Modular so not a big deal, Consistency, Reliability, ..
|
||||
- Drivers for standard buses like USB, PCI, I2C, SPI, ... low-level protocol wrappers. But device drivers are not standardized. Even if they uses same USB protocol, each embedded controllers (specific USB host controller or I2C controller chip) needs independant drivers.
|
||||
- High-level device drivers that uses standard protocol.Like touchscreen, usb webcam, ... Those devices sends data over protocol. Protocol part of driver is done by generic/protocol driver and device-specific drivers are built on top of generic/protocol drivers. Like, parsing data structure on top of passed data through USB or I2C into x-pos and y-pos.
|
||||
- Vendor-specific drivers usually do: "device initialize / power managing / parsing raw data to kernel subsystem / device config like volume, sensitivity.."
|
||||
- high-level behavior and data structures that the device uses over the communication protocol
|
||||
- DKMS
|
||||
10
content/blog/1970-01-01-notes-flash.md
Normal file
10
content/blog/1970-01-01-notes-flash.md
Normal file
@@ -0,0 +1,10 @@
|
||||
---
|
||||
title: Notes - 1. Flash
|
||||
date: 1970-01-01T00:00:00.000Z
|
||||
---
|
||||
|
||||
### 1. NAND Flash Interface
|
||||
|
||||
Interface between cpu and chips. Why? I was wondering about best filesystem for my external SSD, because obviously write-cached external device is bad. I always just unplug my drive without unmounting and ejecting, so I'm always afraid about data corruption. So, i was searching about flash-friendly file systems, and I found JIFFS2 or UBIFS?. JIFFS was familliar, I have seen it from many embedded board projects. It was raw NAND chip friendly. We need FAL? (Flash Abstract Layer) when we use flash chips. But we dont care about these in ssds. Why? Because SSD Controllers embedded in ssd itself manages this abstraction and also controls wearing, also caching in local DRAM. So, we dont need to care about these things when we use SSD. But in embedded board that normally doesnt have seperate controller rather than just attaching NAND chips directly to CPU. Like NOR chip I used several times, NAND is also connected directly. I used QSPI when connecting NOR chip, but SPI was not sufficient for high-speed high data-rate NAND chips. We need parallel communicaion. Even though I have seen a lot of NAND projects, I never saw this part of firmware controlling and parsing NAND signals. I've seen NAND controller firmware that does block-level jobs, but never this interfacing things. So I searched a bit about NAND interface, and I found that there arent many standards in this part. There was ONFI (Open NAND Flash Interface) that defines standard interface for NAND chips, but not many major chips supported, maybe. I saw some documentations like Micron's, and well, that was complex. I dont know yet about hardware timing and things like that, not about that low-level of things. Well but I was interested about that things.
|
||||
Also I learned about Eth PHY and interfaces like MII, GMII... It defines signal level interface and again I am not familiar with these things.
|
||||
And, this was all thing I searched about.
|
||||
27
content/blog/1970-01-01-notes-phy.md
Normal file
27
content/blog/1970-01-01-notes-phy.md
Normal file
@@ -0,0 +1,27 @@
|
||||
---
|
||||
title: Notes - 2. PHY Layer
|
||||
date: 1970-01-01T00:00:00.000Z
|
||||
---
|
||||
|
||||
### 2. PHY?
|
||||
|
||||
What is PHY? Physical Layer from OSI Layers.
|
||||
Usually indicates the chip/part where parses incoming signal (via RF or cable) and then send it to next layer in standardized way. ADC. Analog singal to digital data.
|
||||
Raw Analog <--> Amplifing, Filtering, Equalizing <--> Decoding, Encoding, Error checking (CRC), Clock Data Recovery.. <--> Data Link
|
||||
|
||||
PHY Designs?
|
||||
Line Driver / Amplifier for better analog resolution
|
||||
PLL (Phase-Locked Loops) for CDR and matching clocks from incoming clock/data signal.
|
||||
DSP (Digital Singal Processor) for processing raw data to known format data.
|
||||
|
||||
Eth PHY.
|
||||
MAC. (Media Access Control) <-> PHY via MII GMII (Media Independant Interface)
|
||||
PHY just transform Ethernet Cable signal into data packet.
|
||||
From MAC, actual content of data is interpreted, MAC distinguishes each devices, de/encapsulates.
|
||||
|
||||
Line Driver?
|
||||
Part of transmission line signal. Make sure right signal arrived well. Matching impedence.. etc... (how? and what more?)
|
||||
|
||||
DSP Design?
|
||||
For example in Eth PHY what is processed in DSP? Deserialization? ( Parsing differential signals? => line driver maybe )
|
||||
|
||||
43
content/blog/1970-01-01-notes-sandboxing.md
Normal file
43
content/blog/1970-01-01-notes-sandboxing.md
Normal file
@@ -0,0 +1,43 @@
|
||||
---
|
||||
title: Notes - 6. Sandboxing
|
||||
date: 1970-01-01T00:00:00.000Z
|
||||
---
|
||||
|
||||
### 6. Container & Sandboxing
|
||||
|
||||
Flatpak → OSTree Commits , combining..
|
||||
|
||||
GNOME
|
||||
|
||||
app / org.gnome.Sdk ← org.gnome.Platform/master ← org.freedesktop.Platform/23.08 ,, Minimal linux environment.
|
||||
|
||||
### bwrap, sandbox environment.
|
||||
|
||||
No userspace process isolation so I can see /proc in host, with /proc/{pid}/root which listing it actaully shows me root inside sandbox. via mountinfo I can see it is bindmount from /newroot → /root.
|
||||
|
||||
/newroot is on tmpfs, meaning that there arent any actual ‘files’ mapped in host, so I cant find it.
|
||||
|
||||
/newroot is setted up by bwrap, no “base” image.
|
||||
|
||||
All flatpak commits, including Platform, is bind mounted to container’s folders. e.g. org.gnome.Platform’s files/ will be ro-mounted on /usr@container, and flatpak invokes bwrap with
|
||||
|
||||
symlink /bin /usr/bin, symlink /lib /usr/lib, mkdir /dev, mkdir /tmp, mkdir /sys, mkdir /app … without need of mounting image on root, but it sets up like minimal linux on embedded firmware (e.g. busybox linux)
|
||||
|
||||
App will be ro-binded in /app, platform will be ro-binded on /usr, user-data will be saved at XDGs, $HOME.
|
||||
|
||||
- **BootC?**
|
||||
|
||||
What is bootc?
|
||||
It is exactly same as ostree-native-containers, its original of that.
|
||||
|
||||
### fakeroot
|
||||
|
||||
LD_PRELOAD, geteuid() → return 0. It fools program that uid is 0, but anyways user cant access to real root’s permissions. Just fooling programs that “only allows running as root internally”.
|
||||
|
||||
### containered environment,
|
||||
|
||||
rootless → current user becomes root, any additional users inside container gets virtual uid, in host its just ghost id. real root becomes `nobody` and of course its not accessible by user.
|
||||
|
||||
In here we need “rooless” unpacking. Container Image fill have files with root ownership in their tar archive. So we need fakeroot to unpack image to filesystem, so that “root” files in tar to be extracted.
|
||||
|
||||
### libc and compat layer..?
|
||||
131
content/blog/2023-11-11-kernel-sys-calls.md
Normal file
131
content/blog/2023-11-11-kernel-sys-calls.md
Normal file
@@ -0,0 +1,131 @@
|
||||
---
|
||||
title: Kernel, syscalls
|
||||
date: 2023-11-11T01:22:30.000Z
|
||||
description: "Deep dive Linux Kernel #1"
|
||||
---
|
||||
|
||||
### sys_fork()
|
||||
|
||||
```asm
|
||||
.align 2
|
||||
_sys_fork:
|
||||
call _find_empty_process
|
||||
testl %eax,%eax
|
||||
js 1f
|
||||
push %gs
|
||||
pushl %esi
|
||||
pushl %edi
|
||||
pushl %ebp
|
||||
pushl %eax
|
||||
call _copy_process
|
||||
addl $20,%esp
|
||||
1: ret
|
||||
```
|
||||
|
||||
#### `FUNCTION find_empty_process()`
|
||||
|
||||
```assembly
|
||||
A:
|
||||
IF ++last_pid < 0
|
||||
last_pid = 1
|
||||
FOR i : 0 -> NR_TASKS
|
||||
IF task[i] && task[i].pid == last_pid
|
||||
GOTO A
|
||||
FOR i : 1 -> NR_TASKS
|
||||
IF NOT task[i]
|
||||
RETURN i
|
||||
RETURN -1
|
||||
```
|
||||
|
||||
|
||||
|
||||
1. Set last_pid to 1 or more.
|
||||
|
||||
2. From taskid from 0 to max_tasks, if task exists and pid is last_pid then increases pid and again.
|
||||
3. From taskid from 1 to max_tasks, if tasks not exists, return.
|
||||
|
||||
-> It just iterates through tasks and find last taskid linearly.
|
||||
|
||||
|
||||
|
||||
#### `FUNCTION copy_process`
|
||||
|
||||
```
|
||||
<- nr, EBP, EDI, ESI, GS, EBX~EDX, CS~FS, EIP, EFLAGS, ESP, SS
|
||||
-> INT
|
||||
```
|
||||
|
||||
```assembly
|
||||
TASK_STRUCT P
|
||||
INT I
|
||||
FILE F
|
||||
|
||||
P = (TASK_STRUCT)(GET_FREE_PAGE())
|
||||
|
||||
IF NOT P
|
||||
RET ERR
|
||||
|
||||
SET P
|
||||
START_TIME = RUNNING
|
||||
PID = LAST_PID
|
||||
FATHER = CURRENT_PID
|
||||
COUNTER = PRIORITY
|
||||
START_TIME = jiffies
|
||||
SIGNAL, ALARM, LEADER, UTIME, STIME, CUTIME, CSDTIME, BACK_LINK = 0
|
||||
|
||||
SET TSS
|
||||
BACK_LINK = 0
|
||||
ESP0 = PAGE_SIZE + ADDR(P)
|
||||
SS0 = 0x10
|
||||
EAX = 0
|
||||
ES ~ GS = 0xFFFF
|
||||
LDT = _LDT(nr)
|
||||
|
||||
EIP, EFLAGS = ARGUMENT
|
||||
ECX ~ EDI = ARGUMENT
|
||||
|
||||
TRACR_BITMAP = 0x80000000
|
||||
|
||||
COPY_MEM (nr, p)
|
||||
IF <-
|
||||
FREE_PAGE ADDR(P)
|
||||
RET ERR
|
||||
|
||||
FOR i : 0 ~ NR_OPEN
|
||||
IF
|
||||
f = P.filp[i]
|
||||
THEN
|
||||
INCR f.f_count 1
|
||||
|
||||
IF
|
||||
CURRENT.PWD
|
||||
THEN
|
||||
INCR CURRENT.PWD.i_count 1
|
||||
|
||||
IF
|
||||
CURRENT.ROOT
|
||||
THEN
|
||||
INCR CURRENT.ROOT.i_count 1
|
||||
|
||||
SET_TSS_DESC <- (GDT + nr/2 + FIRST_TSS_ENTRY) , P.TSS
|
||||
SET_LDT_DESC <- (GDT + nr/2 + FIRST_LDT_ENTRY) , P.LDT
|
||||
|
||||
task(nr) <- p
|
||||
|
||||
RET last_pid
|
||||
```
|
||||
|
||||
|
||||
|
||||
- "nr" passed is the index of the new task in the task array, where each element corresponds to a process slot.
|
||||
- fork() copies the parent's kernel context, as well as general registers and segment selectors required for a new process to run in user space.
|
||||
- It creates a new task structure from a new free page and sets up default values and certain parameters inherited from the parent, such as process ID, priority, and execution times.
|
||||
- Then it copies memory regions from the parent to the new process, referred to by "nr," which is the index of the new process in the task array.
|
||||
- Changes the parent process's working directory (PWD) and root directory reference counters, incrementing them by 1 to reflect the new child process now also using these resources.
|
||||
- Sets the Task State Segment (TSS) and Local Descriptor Table (LDT) entries, which are x86-specific structures used for task switching and memory segmentation, respectively.
|
||||
- TSS holds information about the task's stack for privilege level changes and also the hardware context when a task switch occurs.
|
||||
- LDT is a segment descriptor table that stores descriptors for local segments, giving a task its own set of segment registers.
|
||||
- Finally, it assigns the newly created task structure, p, to the task array at index "nr." This effectively makes the new task available for scheduling.
|
||||
|
||||
### `_sys_fork()`
|
||||
"sys_fork" finds an empty process ID using the search loop in `_find_empty_process`, then it invokes `_copy_process` to clone the parent's kernel context to the new process. This sets up a complete environment for the new process to run independently from the parent, but initially as a nearly identical copy.
|
||||
24
content/blog/2023-11-22-bootloader-and-loading-kernel.md
Normal file
24
content/blog/2023-11-22-bootloader-and-loading-kernel.md
Normal file
@@ -0,0 +1,24 @@
|
||||
---
|
||||
title: Kernel, Bootloader
|
||||
date: 2023-11-22T05:35:09.645Z
|
||||
description: "Linux Kernel #2"
|
||||
---
|
||||
|
||||
What bootloader does is:
|
||||
|
||||
1. CPU init
|
||||
2. IVT init
|
||||
3. Hardware Init & finding kernel, loading (initialize external memory interface and filesystem)
|
||||
4. upload kernel from ROM to memort and then jmp to kernel's entry
|
||||
|
||||
so... when bootloader upload kernel into memory space, what address it uploads to?? at zero? from the end??
|
||||
|
||||
if we look at it, its all relative address on compiled kernel, so I thought bootloader would place .data and .bss on some specific regions (like heap-area and stack-area on "normal" memory space)
|
||||
|
||||
but of course in bootloader level, there wouldnt be any memory mapping done or pagin happening, so kernel should be at some fixed address.
|
||||
|
||||
SO Kernel should be PIC(Position Independant Code), \`.text\`, \`.data\`, \`.bss\`is placed with fixed offset, so we can know location of all sections relative to some base address.
|
||||
|
||||
+)
|
||||
|
||||
If one process keep holding context without releasing it to kernel, unless there is external inturrupt or system call from that process, there is no way to steal back context from that process. So we need "timed inturrupt" or "watchdog" to monitor stall processes. (or maybe in multicore we can do this on other core?)
|
||||
47
content/blog/2023-11-26-kernel-process-creation.md
Normal file
47
content/blog/2023-11-26-kernel-process-creation.md
Normal file
@@ -0,0 +1,47 @@
|
||||
---
|
||||
title: Kernel, Process creation
|
||||
date: 2023-11-26T07:44:51.449Z
|
||||
description: "Linux Kernel #3"
|
||||
---
|
||||
```c
|
||||
static int init(void * unused)
|
||||
{
|
||||
lock_kernel();
|
||||
do_basic_setup();
|
||||
|
||||
/*
|
||||
* Ok, we have completed the initial bootup, and
|
||||
* we're essentially up and running. Get rid of the
|
||||
* initmem segments and start the user-mode stuff..
|
||||
*/
|
||||
free_initmem();
|
||||
unlock_kernel();
|
||||
|
||||
if (open("/dev/console", O_RDWR, 0) < 0)
|
||||
printk("Warning: unable to open an initial console.\n");
|
||||
|
||||
(void) dup(0);
|
||||
(void) dup(0);
|
||||
|
||||
/*
|
||||
* We try each of these until one succeeds.
|
||||
*
|
||||
* The Bourne shell can be used instead of init if we are
|
||||
* trying to recover a really broken machine.
|
||||
*/
|
||||
|
||||
if (execute_command)
|
||||
execve(execute_command,argv_init,envp_init);
|
||||
execve("/sbin/init",argv_init,envp_init);
|
||||
execve("/etc/init",argv_init,envp_init);
|
||||
execve("/bin/init",argv_init,envp_init);
|
||||
execve("/bin/sh",argv_init,envp_init);
|
||||
panic("No init found. Try passing init= option to kernel.");
|
||||
}
|
||||
```
|
||||
|
||||
In this `init/main.c`, after basic kernel initialization things, `open("/dev/console")` and two `dup(0)` opens three file descriptor 0, 1, 2 as stdin, stdout, stderr. Later when `execve()` or `fork()` happens, it simply copies calling process's `task_struct` as process context, so all file descriptors are also passed down as-is.
|
||||
|
||||
All processes' file descriptor 0, 1, 2 originates to `init`'s file descriptor.
|
||||
|
||||
If calling process opens PTY or TTY, which is common when we opens new terminal to run a process, it is also passed down to exec/forked process.
|
||||
135
content/blog/2023-11-26-kernel-pty-tty.md
Normal file
135
content/blog/2023-11-26-kernel-pty-tty.md
Normal file
@@ -0,0 +1,135 @@
|
||||
---
|
||||
title: Kernel, PTY and TTY
|
||||
date: 2023-11-26T10:47:11.631Z
|
||||
description: "Linux Kernel #4"
|
||||
---
|
||||
## PTY (Pseudo-TTY), TTY (TeleTYpewriter).
|
||||
|
||||
### TTY
|
||||
|
||||
The term TTY originates from the early days of computing when teletype machines were used as the main way for hci. As technology evolved, the physical teletype machines were replaced with virtual terminals or screens, and TTY is used as interface for text-based communication between a user and the system. TTYs can be hardware-based, like a console, or software-based, commonly known as virtual consoles or terminals (e.g., /dev/tty1, /dev/tty2, etc.).
|
||||
|
||||
### PTY
|
||||
|
||||
A PTY is a Pseudo Terminal, which is a software emulation of a TTY. It allows for the creation of a terminal interface without the need for any actual terminal hardware. A PTY is typically used for providing terminal functionality to processes whose input and output are not directly connected to a physical terminal.
|
||||
PTY is used when you open a terminal window in GUI or SSH. It is used for bridge for real-TTY emulation and dealing with user-facing end of TTY.
|
||||
|
||||
TTY can be thought as two parts. IO, and TTY driver inside of kernel. When process is created, it is attched to some kind of IO device like TTY device as stdout/stdin/stderr. Just like writing to files via file descriptors, outputing and inputing act of process is a wrapper for `read()` and `write()` to "0, 1, 2" file descriptors. What `printf` actually does is `fprintf(stdout, ...)`, in libc.
|
||||
|
||||
Just like in TTY, PTY acts simmilarly, just that it doesnt have actual "hardware" and matching driver, it just differently handles it.
|
||||
|
||||
PTY also has two ends: the master end and the slave end. The master end is used by a terminal emulator, like xterm or GNOME Terminal, to control the terminal session. The slave end provides the interface that emulates the physical terminal, where programs like shells (bash, zsh, ...) read input from and write output to, as if they were interacting with a real TTY.
|
||||
|
||||
### PTY and TTY
|
||||
|
||||
When we open new terminal emulator with shell and check shell's `/proc/{pid}/fd/`, we can see 0, 1, 2 is a symlink to some `/dev/pts/{id}`. If we put data (char data) to /dev/tty0 as `write()`, in kernel (because write is also syscall), data is forwarded to driver code, and then driver transforms and sends char data to TTY as some kind of electronic signal. In case of PTY, it is just same but now instead of driver, kernel just forwards data to other end, `/dev/pty#`, and master process (like terminal emulator) handles that data just like kernel driver, but now it just makes display image out of it (GUI), or sends it to web socket (SSH).
|
||||
|
||||
```c
|
||||
static int pty_write(struct tty_struct * tty, int from_user,
|
||||
const unsigned char *buf, int count)
|
||||
{
|
||||
struct tty_struct *to = tty->link;
|
||||
int c=0, n;
|
||||
char *temp_buffer;
|
||||
|
||||
if (!to || tty->stopped)
|
||||
return 0;
|
||||
|
||||
if (from_user) {
|
||||
down(&tty->flip.pty_sem);
|
||||
temp_buffer = &tty->flip.char_buf[0];
|
||||
while (count > 0) {
|
||||
/* check space so we don't copy needlessly */
|
||||
n = MIN(count, to->ldisc.receive_room(to));
|
||||
if (!n) break;
|
||||
|
||||
n = MIN(n, PTY_BUF_SIZE);
|
||||
n -= copy_from_user(temp_buffer, buf, n);
|
||||
if (!n) {
|
||||
if (!c)
|
||||
c = -EFAULT;
|
||||
break;
|
||||
}
|
||||
|
||||
/* check again in case the buffer filled up */
|
||||
n = MIN(n, to->ldisc.receive_room(to));
|
||||
if (!n) break;
|
||||
buf += n;
|
||||
c += n;
|
||||
count -= n;
|
||||
to->ldisc.receive_buf(to, temp_buffer, 0, n);
|
||||
}
|
||||
up(&tty->flip.pty_sem);
|
||||
} else {
|
||||
c = MIN(count, to->ldisc.receive_room(to));
|
||||
to->ldisc.receive_buf(to, buf, 0, c);
|
||||
}
|
||||
|
||||
return c;
|
||||
}
|
||||
```
|
||||
|
||||
```c
|
||||
static int pty_open(struct tty_struct *tty, struct file * filp)
|
||||
{
|
||||
int retval;
|
||||
int line;
|
||||
struct pty_struct *pty;
|
||||
|
||||
retval = -ENODEV;
|
||||
if (!tty || !tty->link)
|
||||
goto out;
|
||||
line = MINOR(tty->device) - tty->driver.minor_start;
|
||||
if ((line < 0) || (line >= NR_PTYS))
|
||||
goto out;
|
||||
pty = (struct pty_struct *)(tty->driver.driver_state) + line;
|
||||
tty->driver_data = pty;
|
||||
|
||||
retval = -EIO;
|
||||
if (test_bit(TTY_OTHER_CLOSED, &tty->flags))
|
||||
goto out;
|
||||
if (test_bit(TTY_PTY_LOCK, &tty->link->flags))
|
||||
goto out;
|
||||
if (tty->link->count != 1)
|
||||
goto out;
|
||||
|
||||
clear_bit(TTY_OTHER_CLOSED, &tty->link->flags);
|
||||
wake_up_interruptible(&pty->open_wait);
|
||||
set_bit(TTY_THROTTLED, &tty->flags);
|
||||
retval = 0;
|
||||
out:
|
||||
return retval;
|
||||
}
|
||||
```
|
||||
|
||||
```c
|
||||
int __init pty_init(void)
|
||||
{
|
||||
int i;
|
||||
memset(&dev_tty_driver, 0, sizeof(struct tty_driver));
|
||||
dev_tty_driver.magic = TTY_DRIVER_MAGIC;
|
||||
dev_tty_driver.driver_name = "/dev/tty";
|
||||
dev_tty_driver.name = dev_tty_driver.driver_name + 5;
|
||||
dev_tty_driver.name_base = 0;
|
||||
dev_tty_driver.major = TTYAUX_MAJOR;
|
||||
dev_tty_driver.minor_start = 0;
|
||||
dev_tty_driver.num = 1;
|
||||
dev_tty_driver.type = TTY_DRIVER_TYPE_SYSTEM;
|
||||
dev_tty_driver.subtype = SYSTEM_TYPE_TTY;
|
||||
|
||||
if (tty_register_driver(&dev_tty_driver))
|
||||
panic("Couldn't register /dev/tty driver\n");
|
||||
|
||||
dev_syscons_driver = dev_tty_driver;
|
||||
dev_syscons_driver.driver_name = "/dev/console";
|
||||
dev_syscons_driver.name = dev_syscons_driver.driver_name + 5;
|
||||
dev_syscons_driver.major = TTYAUX_MAJOR;
|
||||
dev_syscons_driver.minor_start = 1;
|
||||
dev_syscons_driver.type = TTY_DRIVER_TYPE_SYSTEM;
|
||||
dev_syscons_driver.subtype = SYSTEM_TYPE_SYSCONS;
|
||||
|
||||
if (tty_register_driver(&dev_syscons_driver))
|
||||
panic("Couldn't register /dev/console driver\n");
|
||||
...
|
||||
}
|
||||
```
|
||||
@@ -0,0 +1,293 @@
|
||||
---
|
||||
title: Analyzing My School's Beacon Attendance System
|
||||
date: 2024-03-26T18:00:48+09:00
|
||||
description:
|
||||
---
|
||||
|
||||
**Analysis was for research and educational purposes and did not result in or suggest misuse.**
|
||||
|
||||
I got curious about how our school’s mobile app handled attendance and QR codes, so I cracked open the APK with JADX. As usual, it didn’t take long to decompile and see what was happening behind the scenes. My main goals were simple:
|
||||
- figure out how the attendance system works
|
||||
- see how the app retrieves the QR code for ID cards.
|
||||
|
||||
|
||||
### 1. APK
|
||||
|
||||
Once you decompile an APK, it’s mostly just a matter of renaming stuff and deobfuscating. Looking at internal logic, I discovered that there wasn't any authentication going on, it just read attributes of beacon (which is very likely to be fixed value), and send it to server. So we didnt need to think about any kind of token-based authentication going on inside iBeacon which I could never analyze or manipulate. So I need to look at what it sends to server.
|
||||
|
||||
|
||||
### 2. MITM
|
||||
|
||||
So now we have to analyze its packets to potentially replay it by myself. Using `apk-mitm` and `uber-apk-signer`, I modified app for use with mitmproxy.
|
||||
The app also had this whole signature‑checking thing on startup and for “secure actions,” so I had to find a way around that first.
|
||||
|
||||
1. Startup
|
||||
|
||||
It retrieves App signature from `https://mob.snu.ac.kr/api/versionCheck.action` on splash screen. Using mitmproxy script, we can easily modify server's response.
|
||||
|
||||
```python
|
||||
def response(flow: http.HTTPFlow) -> None:
|
||||
url = flow.request.pretty_url
|
||||
if url == "https://mob.snu.ac.kr/api/versionCheck.action":
|
||||
data = json.loads(flow.response.get_text())
|
||||
data["VERSION"]["SIGN_KEY"] = "MYSIGNATURE"
|
||||
flow.response.text = json.dumps(data)
|
||||
```
|
||||
|
||||
2. JNI Signature checking.
|
||||
|
||||
It uses JNI `libEncryptionKeyStore.so` for additional `checkRoot`. Even though it’s called checkRoot, what it actually does is verify the app’s signature with a bunch of simple loops and comparisons. When it doesnt match, it branches into `std::terminate`.
|
||||
|
||||
```
|
||||
00007d48 int64_t x0_8 = data_3d158
|
||||
00007d50 if ((*(x0_8 - 8) & 0x80000000) == 0)
|
||||
00007d58 sub_ba58(&data_3d158)
|
||||
00007d5c x0_8 = data_3d158
|
||||
00007d68 *x0_8 = 0x35
|
||||
...
|
||||
```
|
||||
|
||||
Since original signature is hard-coded into binary, we can either modify binary as our signature or just bypass checking function.
|
||||
Replacing every single byte manually would’ve been a nightmare, so I decided to automate it. To track down where every bytes are assigned, I just wrote my own machine codes parser and keeped track of important registers. I matched binary expressions into opcode and tracked down when and where it stored bytes into string register, and changed it into my signature.
|
||||
|
||||
|
||||
**Or**, we can simply modify library itself to just bypass `b std::terminate` to `ret`. It doesn’t return anything, so a plain return should be fine.
|
||||
|
||||
```
|
||||
0000830c 43801fb8 stur w3, [x2, #-0x8]
|
||||
00008310 f8ffff17 b 0x82f0
|
||||
00008314 04030094 bl std::terminate --> ret
|
||||
{ Does not return }
|
||||
```
|
||||
|
||||
|
||||
### 2. JNI Sniffing
|
||||
|
||||
After bypassing signature check, we can now test various packets sent from application. But as expected, it used additional encryption on every data it sends.
|
||||
I expected the whole encryption to happen inside JNI, but surprisingly it only used it to grab a secret key.
|
||||
|
||||
```java
|
||||
package com.ubivelox.security;
|
||||
public class EncryptionKeyStore {
|
||||
static {
|
||||
System.loadLibrary("EncryptionKeyStore");
|
||||
}
|
||||
public String secretKeyEx() {
|
||||
return getSecretKeyEx();
|
||||
}
|
||||
public native void checkRooting(String str);
|
||||
public native String getBleInfo();
|
||||
public native String getSecretKeyEx();
|
||||
}
|
||||
```
|
||||
|
||||
So important things were all in this JNI. App sends request as `{header: encryped-header, body: body}` and this encryption key is retrieved with `getSecretKeyEx()` as JNI. So I need to somehow extract key from this function.
|
||||
|
||||
```c
|
||||
00007124 int64_t var_38 = time(nullptr)
|
||||
00007130 int32_t x1 = *(localtime(&var_38) + 0x10)
|
||||
00007134 int32_t x1_1 = x1 + 1
|
||||
00007138 int32_t x0_9
|
||||
00007138 if (x1 + 1 s< 0)
|
||||
00007388 x0_9 = 0
|
||||
00007150 else
|
||||
00007150 int32_t x0_7 = ((muls.dp.q(x1_1, 0x2aaaaaab) u>> 0x20).d s>> 1) - (x1_1 s>> 0x1f)
|
||||
0000715c x0_9 = x1_1 - ((x0_7 << 4) - (x0_7 << 2))
|
||||
```
|
||||
|
||||
First, it calculates some kind of index from current time. I didnt know what was going on here exactly, but I learned that multipling `0x2aaaaaab` thing is to divide number by 3. Well, the calculation wasnt 'understandable' for me, so I just moved this into C code and observed the output. Surprisingly, it outputted only fixed value.
|
||||
|
||||
```armasm
|
||||
00007180 1f040071 cmp w0, #0x1
|
||||
00007184 60100054 b.eq 0x7390
|
||||
00007188 1f080071 cmp w0, #0x2
|
||||
0000718c e0150054 b.eq 0x7448
|
||||
...
|
||||
000071d0 1f2c0071 cmp w0, #0xb
|
||||
000071d4 210c0054 b.ne 0x7358
|
||||
```
|
||||
|
||||
They wrote code to do some kind of key rotating with that index above, and that index was fixed, so it was just all useless obsfucation. (but it is more likely that I didnt looked it carefully and it changes daily or randomly)
|
||||
|
||||
+) And some days later it's April. Output index has changed . So it was like rotating every three months?
|
||||
|
||||
```asm
|
||||
00007204 06078052 mov w6, #0x38
|
||||
00007208 29078052 mov w9, #0x39
|
||||
0000720c 88068052 mov w8, #0x34
|
||||
00007210 65088052 mov w5, #0x43
|
||||
00007214 acd30039 strb w12, [x29, #0x34 {var_30+0x4}] {0x46}
|
||||
00007218 a3f30039 strb w3, [x29, #0x3c {var_28+0x4}] {0x44}
|
||||
0000721c 2c068052 mov w12, #0x31
|
||||
00007220 ab070139 strb w11, [x29, #0x41 {var_20+0x1}]
|
||||
00007224 ab068052 mov w11, #0x35
|
||||
```
|
||||
|
||||
Each subroutine builds key into var_30, var_20, ... , so I just need to write down these keys right?
|
||||
|
||||
Well it wasnt. After each subroutine it all branched into this part.
|
||||
|
||||
```asm
|
||||
00007358 820240f9 ldr x2, [x20]
|
||||
0000735c e00314aa mov x0, x20
|
||||
00007360 429c42f9 ldr x2, [x2, #0x538]
|
||||
00007364 40003fd6 blr x2
|
||||
00007368 73ce47f9 ldr x19, [x19, #0xf98] {__stack_chk_guard}
|
||||
0000736c a22f40f9 ldr x2, [x29, #0x58 {var_8}]
|
||||
00007370 610240f9 ldr x1, [x19]
|
||||
00007374 5f0001eb cmp x2, x1
|
||||
00007378 413b0054 b.ne 0x7ae0
|
||||
0000737c f35341a9 ldp x19, x20, [sp, #0x10] {__saved_x19} {__saved_x20}
|
||||
00007380 fd7bc6a8 ldp x29, x30, [sp], #0x60 {__saved_x29} {__saved_x30}
|
||||
00007384 c0035fd6 ret
|
||||
00007388 00008052 mov w0, #0
|
||||
0000738c 75ffff17 b 0x7160
|
||||
```
|
||||
|
||||
It loads x20 into x2 and branches into value of `x2+0x538`. And x20 was saved value of `int64_t* arg1`, which is JNIenv passed from Java.
|
||||
And of course I spend a lot of hard time figuring out what this function does. I just couldnt see where that function was, and this was almost first time analyzing JNI. I didnt even knew any Android programming.
|
||||
And honestly, I gave up at this point. I even tried to read all defined functions, but I couldnt find anything useful.
|
||||
|
||||
|
||||
I had to find other way. And I rememdered about library sniffing. You know, we can sniff and log return values using mocked JNI, which just forwards function calls. We can even bypass `checkRoot` by just not actually calling it.
|
||||
|
||||
So I just did that. I wrote my own shared object, and named original one ~.orig.so. Now what I should do is to call original fcuntions inside my own shared object. Its like LD_PRELOAD. Now I can just grab encryption key using `adb logcat`.
|
||||
|
||||
```cpp
|
||||
#include "com_ubivelox_security_EncryptionKeyStore.h"
|
||||
#include <dlfcn.h>
|
||||
#include <stdio.h>
|
||||
#include <android/log.h>
|
||||
|
||||
void* libhandle = dlopen("libEncryptionKeyStore-orig.so", RTLD_LAZY);
|
||||
|
||||
typedef void (*checkRooting_ft)(JNIEnv*, jobject, jstring);
|
||||
typedef jstring (*getBleInfo_ft)(JNIEnv*, jobject);
|
||||
typedef jstring (*getSecretKeyEx_ft)(JNIEnv*, jobject);
|
||||
checkRooting_ft checkRooting_ptr;
|
||||
getBleInfo_ft getBleInfo_ptr;
|
||||
getSecretKeyEx_ft getSecretKeyEx_ptr;
|
||||
|
||||
JNIEXPORT void JNICALL checkRooting(JNIEnv* arg1, jobject arg2, jstring arg3) {
|
||||
if (!checkRooting_ptr)
|
||||
checkRooting_ptr = (checkRooting_ft)dlsym(libhandle, "Java_com_ubivelox_security_EncryptionKeyStore_checkRooting");
|
||||
if (checkRooting_ptr)
|
||||
// return checkRooting_ptr(arg1, arg2, arg3);
|
||||
return;
|
||||
}
|
||||
|
||||
JNIEXPORT jstring JNICALL getBleInfo(JNIEnv* env, jobject obj) {
|
||||
if (!getBleInfo_ptr)
|
||||
getBleInfo_ptr = (getBleInfo_ft)dlsym(libhandle, "Java_com_ubivelox_security_EncryptionKeyStore_getBleInfo");
|
||||
if (getBleInfo_ptr) {
|
||||
jstring ret = getBleInfo_ptr(env, obj);
|
||||
|
||||
const char *cStr = env->GetStringUTFChars(ret, NULL);
|
||||
if (cStr == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
char log[2048] = {0};
|
||||
snprintf(log, sizeof(log), "getBleInfo: %s", cStr);
|
||||
__android_log_write(ANDROID_LOG_ERROR, "libEncryptionKeyStore", log);
|
||||
env->ReleaseStringUTFChars(ret, cStr);
|
||||
return ret;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
JNIEXPORT jstring JNICALL getSecretKeyEx(JNIEnv* env, jobject obj) {
|
||||
if (!getSecretKeyEx_ptr)
|
||||
getSecretKeyEx_ptr = (getSecretKeyEx_ft)dlsym(libhandle, "Java_com_ubivelox_security_EncryptionKeyStore_getSecretKeyEx");
|
||||
if (getSecretKeyEx_ptr) {
|
||||
jstring ret = getSecretKeyEx_ptr(env, obj);
|
||||
|
||||
const char *cStr = env->GetStringUTFChars(ret, NULL);
|
||||
if (cStr == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
char log[2048] = {0};
|
||||
snprintf(log, sizeof(log), "getSecretKeyEx: %s, %p", cStr, *(*env + 0x538));
|
||||
__android_log_write(ANDROID_LOG_ERROR, "libEncryptionKeyStore", log);
|
||||
env->ReleaseStringUTFChars(ret, cStr);
|
||||
return ret;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_com_ubivelox_security_EncryptionKeyStore_checkRooting (JNIEnv* arg1, jobject arg2, jstring arg3)
|
||||
{
|
||||
return checkRooting(arg1, arg2, arg3);
|
||||
}
|
||||
JNIEXPORT jstring JNICALL Java_com_ubivelox_security_EncryptionKeyStore_getBleInfo (JNIEnv* arg1, jobject arg2)
|
||||
{
|
||||
return getBleInfo(arg1, arg2);
|
||||
}
|
||||
|
||||
JNIEXPORT jstring JNICALL Java_com_ubivelox_security_EncryptionKeyStore_getSecretKeyEx (JNIEnv* arg1, jobject arg2)
|
||||
{
|
||||
return getSecretKeyEx(arg1, arg2);
|
||||
}
|
||||
```
|
||||
|
||||
> ```
|
||||
> 03-26 11:04:03 E libEncryptionKeyStore: RETURN: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
|
||||
> ```
|
||||
|
||||
So now I had the encryption key and all the packets, it's time to decrypt messages and build our own requests!
|
||||
|
||||
Messages were encrypted in AES-CBC mode with IV of just 0s, padded with PKCS#5.
|
||||
|
||||
I modified mitm script to automatically decrypt messages and log them.
|
||||
|
||||
```python
|
||||
elif "https://scard1.snu.ac.kr/" in url:
|
||||
req = json.loads(flow.request.get_text())
|
||||
data = json.loads(flow.response.get_text())
|
||||
with open(LOG, "a") as f:
|
||||
f.write(flow.request.pretty_url))
|
||||
f.write(decrypt(req["header"]).decode())
|
||||
f.write(req["body"])
|
||||
f.write(decrypt(data["header"]).decode())
|
||||
f.write(data["body"])
|
||||
```
|
||||
|
||||
Everything looked clear, except for this enc field inside the “header” part of the body (not the HTTP header). It's just a SHA‑1 of the body, probably for verification. I have all of informations, now I can just send requests to server, retrieve class and lecture infos and do attendance.
|
||||
|
||||
|
||||
### 5. EAMS
|
||||
|
||||
As in case of Attendace Checking, It uses BLE Beacon (or iBeacon).
|
||||
|
||||
At first I thought there should be some kind of randomization and special ble service, but it just sends existing and constant beacon data (UUID, MacAddress, ...) to server.
|
||||
|
||||
It looked super easy to spoof, so theoretically I could just spin up my own BLE server with matching UUIDs and all that, then use the unmodified app to mark attendance like normal. Modifing and sending custom built raw packets could be illegal in some circumstances, so this way is more safe and undetectable.
|
||||
|
||||
Attendance packets involves encryption twice. Once in other encrypts header, and twice it encrypts BLE beacon data in header. I dont know why they encrypt twice, but there should be some context in it.
|
||||
|
||||
Using all of informations, now we can save BLE data and send our own attendance, and potentially take an attendance without attending!
|
||||
|
||||
*But one thing, it sends data without any cookies or authentication about student data. So no need any account information but student id. This made me little bit concerned and I decided to keep analyzing app.*
|
||||
|
||||
|
||||
### 6. Mobile ID, QR code
|
||||
|
||||
So going back to original task, retrieving Mobile QR Code with my own.
|
||||
|
||||
Since I anaylzed deep about app's behaviour now, I just needed to read through source one more time and it was it. I did exactly same thing but with mobile id, and it was very simmilar except it used raw hex digested form instead of base64 encoded form.
|
||||
|
||||
One thing very surprising was that mobile id also didn't used authentication. Mobile ID is used on various identifications simmilar to ID card. This level of personal information is retrieved without any authenticaion but only student id which is very opened. It seems like problem..
|
||||
|
||||
Anyways we also can retrieve Mobile ID QR code and Profile Picture (ID Picture registered) with our own.
|
||||
I at least expected it to ask for some authentication, so no authentication was bit of a surprise (and a convenience).
|
||||
|
||||
<br>
|
||||
|
||||
### Afterthoughts
|
||||
|
||||
It seemed very complex at first but solution turned out pretty simple and straightforward. I bet anyone could do it if one puts some times in it, I wonder why this wasn't the case. Maybe because it's technically illegal, so not exactly the thing one want to do.
|
||||
|
||||
Also, hardcoding encryption keys or verification tokens inside the app itself seems dangerous, as I could extract keys from decompilation. As any app has potential to be preloaded and just sniffed, especially JNI like this case, so using JNI to retrive raw keys is not that good I think.
|
||||
|
||||
Also obviously they need to add some kind of authentication. There was SSO token field on their API, but it wasnt used anyway. A LOT of things were done without authentication, at least I can see on my logs. They should fix this. Since it’s an institutional thing, I guess they just don’t really care. Maybe they know about it and just ignored it.
|
||||
|
||||
PS: I always thought HTTPS sniffing on iOS would be nearly impossible, but turns out it’s way easier than I expected. I dont even needed to modify an app or smth, I could just enable global setting. What a surprise.
|
||||
114
content/blog/2025-09-17-analyzing-various-emv-smartcards.md
Normal file
114
content/blog/2025-09-17-analyzing-various-emv-smartcards.md
Normal file
@@ -0,0 +1,114 @@
|
||||
---
|
||||
title: Analyzing various EMV & smartcards
|
||||
date: 2025-09-17T00:00:00.000Z
|
||||
---
|
||||
|
||||
### 1. Analyzing VISA payment flow
|
||||
|
||||
|
||||
### 2. Transit and Offline Data Authentication
|
||||
|
||||
|
||||
### 3. About domestic cards
|
||||
|
||||
| DESC | AID | Comments |
|
||||
| ------------- | -------------- | ------------------ |
|
||||
| VISA | A0000000031010 | |
|
||||
| MASTERCARD | A0000000041010 | |
|
||||
| KOREACREDIT | D4100000011010 | BC Card? |
|
||||
| KOREACREDIT | D4100000012010 | LOCAL(V) |
|
||||
| KOREA(?) | D4100000013010 | LOCAL(M) |
|
||||
| | D4100000014010 | Appears on EMV QR |
|
||||
|
||||
Domestic AIDs can be found on domesic-only cards, and cobranded cards only shows corresponding global AID.
|
||||
|
||||
Example: **KB Domestic-only card**
|
||||
|
||||
```
|
||||
6F | File Control Information (FCI) Template
|
||||
84 | Dedicated File (DF) Name
|
||||
[7] D4 10 00 00 01 20 10
|
||||
A5 | File Control Information (FCI) Proprietary Template
|
||||
50 | Application Label : "KOREACREDIT"
|
||||
87 | Application Priority Indicator : 01
|
||||
5F2D | Language Preference : "koen"
|
||||
9F11 | Issuer Code Table Index : 01
|
||||
9F12 | Application Preferred Name : "KMC_CHECK"
|
||||
BF0C | File Control Information (FCI) Issuer Discretionary Data
|
||||
9F6E | Third Party Data
|
||||
Country: Korea, Republic of
|
||||
Unique Identifier: Proprietary Data not used
|
||||
Device Type: 00 - Card
|
||||
Proprietary Data: Not used
|
||||
```
|
||||
|
||||
### 4. Miscellaneous Informations
|
||||
|
||||
### 1) Student ID
|
||||
|
||||
Seoul National University's Student ID is in AID `D410000005494401`.
|
||||
|
||||
== Authentication Flow ==
|
||||
```
|
||||
1. SELECT
|
||||
-> 00 A4 04 00 08 D4 10 00 00 05 49 44 01
|
||||
<- [61 2E]
|
||||
|
||||
2. GET RESPONSE
|
||||
-> 00 C0 00 00 2E
|
||||
<- [90 00] 6F 2C 84 08 D4 10 00 00 05 49 44 01 A5 20 50 14 53 54 55 44 45 4E 54 20 49 44 20 20 20 20 20 20 20 20 20 20 BF 0C 07 01 00 00 00 00 00 00
|
||||
|
||||
6F |
|
||||
84 | "D410000005494401"
|
||||
A5 |
|
||||
50 | "STUDENTID"
|
||||
BF0C | "01000000000000"
|
||||
|
||||
3. GET CHALLENGE
|
||||
-> 00 84 00 00 10
|
||||
<- [90 00] [ 16 byte RAND ]
|
||||
|
||||
4. CREATE SESSION
|
||||
-> 90 8A 00 81 14 [ 16 byte RAND ] [ 4 byte MAC ]
|
||||
<- [90 00]
|
||||
|
||||
5. EXTERNAL AUTH
|
||||
-> 00 82 00 82 04 [ 4 byte MAC ]
|
||||
<- [90 00]
|
||||
|
||||
6. READ RECORD
|
||||
-> 00 B2 01 0C C8
|
||||
<- [90 00] ...
|
||||
|
||||
01 |
|
||||
02 | UNIV CODE (SNU:"0345")
|
||||
03 | TYPE ("1")
|
||||
04 | ID NUMBER
|
||||
05 | ISSUE NO
|
||||
06 | NAME (EUC-KR)
|
||||
07 | ID NUMBER
|
||||
08 | 000000000000000000000000000000000000000000000000
|
||||
09 | PADDING
|
||||
```
|
||||
|
||||
Crypto algrithm is likely to be SEED.
|
||||
|
||||
As suspected, reading personal information requires SAM and Key. I dont have access to SAM, so I can't extract information from random ID card.
|
||||
|
||||
But since they doesn't do mutual authentication, I possibly can emulate any student ID if I know correct card issue number. I made an PoC app to emulate any card as HCE, and I confirmed that it works on almost all reader.
|
||||
|
||||
Although some reader may use pre-registered MIFARE UID for identification.
|
||||
|
||||
### 2) payOn
|
||||
|
||||
payOn is domestic contactless protocol that's only used on credit based fare system and few merchants.
|
||||
|
||||
It uses MIFARE Classic 1k that's already compromised long time ago, so its considered unsafe.
|
||||
|
||||
I managed to crack full memory in about 3 mins, and I "confirmed" it works just fine as real card.
|
||||
|
||||
== payOn Memory structure? ==
|
||||
```
|
||||
Log: [YY MM DD HH MM SS] FFFF [MERCHANT CODE?] [AMOUNT IN WON] [CTR] [PADDING?] [CKSUM]
|
||||
|
||||
```
|
||||
0
content/blog/_index.md
Normal file
0
content/blog/_index.md
Normal file
31
content/personal/2021-01-28-what-i-wanted-to-do.md
Normal file
31
content/personal/2021-01-28-what-i-wanted-to-do.md
Normal file
@@ -0,0 +1,31 @@
|
||||
---
|
||||
date: 2021-01-28T06:14:00.000Z
|
||||
description: ""
|
||||
draft: false
|
||||
title: 나는 무엇을 하고 싶은 걸까나
|
||||
---
|
||||
나는 개발자가 되고 싶었다. 그래서 나 나름대로 여러가지 언어를 배우기도 했고 컴퓨터 관련된 여러 가지 활동을 하면서 나의 꿈을 키워나간다고 믿었다. 고등학교를 다니면서 외적으로 개인적인 공부도 많이 하고 있고, 이를 바탕으로 진로를 정하려고 했다. 고등학교 3학년이라 앞으로의 진로를 정해야 했고, 이런 저런 고민을 하다 보니 내가 공부했던 것들이, 또 내가 알고 있는 것들이 단순히 빙산의 일각이라는 사실을 깨달았다.
|
||||
|
||||
과학고를 다니는 덕에 수학적인 내용을 기본으로 하는 여러가지 컴퓨터 분야에 대해서는 나름 쉽게 공부할 수 있었다. 문턱이 낮았던 덕에 컴퓨터 아키텍쳐나 논리회로, FPGA, 어셈블리 언어에 대해서까지 공부를 하고는 했다. 이외에도 미래지향적인 양자컴퓨터나 양자논리에 대해서는 특히 관심을 가지고 있었고, 반도체에도 큰 관심이 있었다. 지금 돌이켜 보면 그냥 컴퓨터에 관련된 것이면 폭넓게 무엇이든 관심을 가졌었던것 같다. 컴퓨터란 물체를 설명하는 여러 원리나 그것을 활용하는 여러 방법에 대해 깊은 호기심이 있었다.
|
||||
|
||||
2학년, 대학을 지원하기 시작하면서 진로를 정할 때 즈음에는 정보보안에 대해 공부하고 있었기에 그 주제를 진로로 잡고 자기소개서를 썼었다. 내가 정보보안에 관심을 두게 된건 [Live Overflow](https://www.youtube.com/channel/UClcE-kVhqyiHCcjYwcpfj9w)란 외국의 유튜버를 알게 되고 나서였는데, "비밀"이라는 알려지지 않은 부분들을 탐구하고 분석해 나간다는게 흥미로웠던 것 같다. 나에게 정보보안이라는 분야 자체가 생소했고, 또 비슷한 수학 분야를 공부했었기에 자연스럽게 그쪽 분야에 흥미를 느낀것도 없지 않아 있을 듯하다.
|
||||
|
||||
대학교에 떨어지고 나서 좌절하고 방황하고 있을 때 고맙게도 때마침 포스텍 해킹캠프에 참가했다. 보안쪽을 나름대로 미리 공부해 두었다고 생각했기에 부담없이 참여할 수 있겠구나 생각하고 있었는데, 나중에 최하위 점수를 받았다. 팀 협업이 잘 되지 않았던 점도 있겠지만, 나는 아, 결국에 내가 무얼 하든지 각 분야에서는 이미 나보다 잘하는 사람이 넘쳐나구나, 라는것을 깨달았다. 제한된 환경에서 제한된 교육만을 받고 자라온 나로서는 그때까지 이런 점들을 느끼기 힘들었다. 전국적인 대회에 참여하면서 나는 살면서 한번도 느껴보지 못했던 열등감을 느꼈다. 때마침 개인적으로 공부하던 부분에서도 한계를 느꼈고, 이걸 직면하고 나니 나는 컴퓨터라는 분야에 처음으로 싫증이 났다.
|
||||
|
||||
정확히 말하면 싫어졌다기 보다는 지겨워졌다는 의미가 더 맞는 것 같다. 아키텍쳐나 어셈블리 언어에 대한 내용은 컴퓨터에 대한 호기심을 잃지는 않았는지 중간중간 남는 시간이면 찾아보거나 여러 글을 읽으며 공부를 하고 있기는 하지만, 개발이라는 것에 대한 의미를 잃고 말았다. 물론 이 일련의 사건은 다른 사람의 입장에서 봤을때 별것 아닐테지만.. 개인적으로는 좀 충격이었다.
|
||||
|
||||
#### **결심?**
|
||||
|
||||
나는 앞으로 컴퓨터란 분야가 어떵게 발전될지 개발 양상이나 그러한 기술적, 경제적 이야기 하는것을 좋아한다. 이러한 분야에 관심이 있는 친구에게 나의 이런 저런 생각을 공유하고는 했다. (이러한 점은 우리 아버지의 영향이 가장 컸던것 같다.) 이런 저런 얘기를 하다 보면 결국에는 항상 대학이 중요하다는 결론이 나고는 했다. 대학에 대한 이야기를 하다 보면 나의 진학에 대한 이야기가 안나올 수 없었고, 이런 이야기를 하며 나는 마음 속으로 진로 방향을 결정해야 했다. 나는 원래 컴퓨터 공학과에 진학하고 싶었다. 더 나아가 공부 스탯을 쌓아 결론적으로 정보보안 대학원에 진학하는 것이 내 중간 목표였다. 사실 최종 목표는 컴퓨터 분야에 대한 패러다임을 새롭게 만들고 싶다는 말도 안되는 거창한 것이었는데, 지금 생각해 보면 무척이나 헛된 꿈이었던 것 같다.
|
||||
|
||||
나는 암호학, 정보보안, 네트워크, 로우-레벨 코딩, 하드웨어 설계, 반도체, 양자컴퓨터, 소프트웨어 공학, 등등.. 여러 분야에 관심을 가지고 있었다. 위에 있는 단어를 나열하면서 가장 나에게 끌렸던 분야는 다름아닌 반도체와 하드웨어 프로그래밍, 로우레벨 코딩이 가장 끌렸었다. 이런 결정을 내리는 과정에서 고민을 꽤 했는데.. 내가 제일 최종적으로 하고 싶었던 일은 무엇이었을까..? 아마.. 컴퓨터 아키텍처를 분석하고 그런 시스템을 리버싱 하거나 설계하는 것이였던 것 같다. 마냥 소프트웨어 공학이나 개발보다는 그냥 논리회로 같이 컴퓨터 기계적인 분야에 더 관심이 있었고, 양자컴퓨터에 대해서 공부를 하다 보면 또 양자세계에서는 다르게 적용되는 새롭게 정리되고 개발되는 아키텍처에 대해서도 공부하고 싶었다. 이런것들을 생각하고 생각하다 보니 결국 시간이 다가왔고, 컴퓨터 공학과인지 전기전자 공학과 인지 결정해야 할 때가 와버렸다. 컴퓨터 공학과는 뭐랄까.. 너무 공학의 느낌이 안났다. 뭐 딱히 그래서는 아니지만, 난 컴퓨터도 배울 수 있고 또 반도체/하드웨어 분야에 대해서도 연구를 하는 전기전자 공학과를 가고 싶어졌다.
|
||||
|
||||
이제 고등학교 3학년이라, 그러한 고민을 하기에 적당한 시기였지 않나 싶다. 전기전자 공학과를 가기로 한 이상 이제 대학교나 그 이상의 구체적인 계획을 세울 때가 되었었다. 같은 전기전자 공학과라도 서울대도 있고 카이스트도 있고 포항공대도 있다. 하지만 이미 진학 실패를 경험한 나로서는 어떤 대학에 들어간다거나 어디를 붙을 수 있는지 내 위치가 정확히 어딘지 잘 모르겠었다. 물론 제일 가고 싶은 것은 서울대학교이겠지만 그것은 이미 오래전에 막혔고. 나의 미비한 성적으로는 잘해봤자 카이스트에 가는 정도였던 것이다. (그것도 이번 내신을 엄청나게 잘 봤을때의 이야기이다.)
|
||||
|
||||
나는 포스텍도, 카이스트도 고려대학교도, 연세대학교 별 상관은 없었다. 어디를 가든 대학교에 가면 심화된 교육을 받을 수 있을테고, 또 나의 꿈을 실현시키는 데에는 내 노력이 필요하지 학교는 별 상관이 없을 테다. 근데 대학은 가야하지 않는가.. 그렇다. 나는 지금 공부를 해야 한다. 한국에서 가장 공부를 많이 한다는, 고3이라는 시절에 나는 무엇을 하고 있는걸까. 난 방황하는 척 하며 사실 놀았던 것과 다르지 않았다. 아무리 공부를 했어도 하고싶은 공부만 골라서 했으며 실제로 노력한 시간은 별로 없었다. 물론 지금까지의 생활에서는 충분히 많이 노력하고 있지만, 고등학교 3학년이라는 시기에 비해서는 (내가 상상한 것에 비해서), 또 내가 원하는 학교를 가서 내가 원하는 일을 할 수 있는 정도의 공부를, 노력을 나는 지금 하고 있지 않는것 같다.
|
||||
|
||||
얼마나 합리화를 해도 내가 충분히 노력했다고 생각할 수는 없을 것 같다. 하루종일 다른 생각 안하고 공부에만 매진해도 결국에는 체력이 딸려서 몇분동안은 졸게 되어있고, 아무리 열심히 다짐해도 컴퓨터 인터넷 한번에 모든 것이 무너져 내리기도 했다. 참, 이런 생각을 하니까 옛날 부모님이 하신 말씀이 생각이 난다. 너 생각하는 열심은 열심이 아니라고, 더 열심히 해야 한다고 자주 말씀하시곤 했는데, 어렸을 때에는 이러한 말을 잔소리로만 생각했다. 엄마는 내가 얼마나 노력하는지 모르면서 엄마의 기준을 들이대지 말라고 말이다. 진정으로 열심히 하고 있다면, 그것은 자신에게는 '더 열심히 해야 한다'라는 강박과 '더 열심히 하고 싶다'의 욕망의 형태로 다가와야 한다. 아무리 집중하고 노력해도 불안하고 더 해야하는 것 같아서, 더 열심히 해야 한다고 생각해서, 진심으로 자신을 밀어붙이는 상태가 되어야 열심히 했다고, 열심히 하고 있다고 할 수 있다.. 라고 생각이 들기도 한다.
|
||||
|
||||
어쨋든 결론적으로 대입이 가까워 지니 여러 가지 생각이 들면서 긴박해 졌고, 전혀 쓰지도 않던 블로그도 쓰고 있다.. 이런 생각들을 정리하면서 글을 쓰다 보니까 여러 가지 주제에 대해서 깊게 생각하게 되는것 같다.
|
||||
|
||||
이제 공부하러 가야지..
|
||||
18
content/personal/2021-06-20-week-before-exam.md
Normal file
18
content/personal/2021-06-20-week-before-exam.md
Normal file
@@ -0,0 +1,18 @@
|
||||
+++
|
||||
date = 2021-06-20T09:23:28Z
|
||||
description = ""
|
||||
draft = false
|
||||
aliases = ["/personal/20210620-siheomeul-iljuil-apdugo/"]
|
||||
title = "시험을 일주일 앞두고"
|
||||
|
||||
+++
|
||||
|
||||
|
||||
지금까지 내 인생에서 가장 중요한 시험. 그 시험이 일부일 앞으로 다가왔다. 하루종일 시험공부 비슷한걸 하면서 심신이 지쳐 더 이상 집중을 할 수 없을 것 같다. 이제 이 고비만 넘기면 인생에서 가장 날아다닌다는 시기, 대학생이 된다. 앞으로 뭘 하고 살아야 할지, 무엇을 하고 싶은지, 내가 아는 게 많아지고 현실을 깨달으면서 철이 드니 생각이 복잡해지고 앞길이 막막하기만 하다.
|
||||
|
||||
몇일 전, 작년에 대학 원서 자기소개서를 다시 읽다 보니 내가 아는 게 많아졌음을 새삼 깨달았다. SW나 해킹이나 반도체에 대해 몇달동안 파고 들어 공부하고, 조사하고 생각하다 보니 전에보다 더 자세하게, 깊게 알게 되었고, 예전과는 살짝 다른 생각을 하게 되었다. 예전에는 마냥 컴퓨터공학이나 해킹이 하고 싶었던 반면 지금은 더 자세하게 무엇이 하고 싶은지에 대한 목록을 작성할 수 있게 되었다. 각종 주제에 대해서도 흥미를 갖게 되었고 특히 예전에는 그냥 넘어갔던 책들을 다시 읽어보고 싶어졌다. 앎에 대한 욕구가 끝없이 증가해 버렸다. 지금 교보문고에 있는 읽고싶은 책들만 합해도 100만원이 넘어가니 말이다.
|
||||
|
||||
아마 올해 자기소개서를 쓸 때에는 정말 깔끔하고 자세한 자기소개서를 쓸 수 있지 않을까 싶다. 개발자 이력서 쓰는 법이나 회사 취직에 관한 글을 꽤 읽었으니 기술적으로도 단정한 글이 되지 않을까 싶다. 항상 느끼는 것이, 이건 대학 자소서 준비인지 아니면 그냥 개발자의 자기소개서인지 의문이 든다. 그럴 정도로 기술적인 내용을 많이 집어넣는데, 이게 과학고생의 글인지 아니면 디미고 같은 개발중점 학교 학생의 글인지 햇갈린다.
|
||||
|
||||
짧은 회고록이 되었지만 2주 후, 자소서를 쓰고 있을 나를 상상하니 빨리 지나갔으면 좋겠다는 생각밖에 들지 않는다.
|
||||
|
||||
29
content/personal/2021-10-08-blogging-is-hard.md
Normal file
29
content/personal/2021-10-08-blogging-is-hard.md
Normal file
@@ -0,0 +1,29 @@
|
||||
---
|
||||
date: 2021-10-08T05:19:00.000Z
|
||||
description: ""
|
||||
draft: false
|
||||
title: 블로그 글쓰기는 너무 힘들어
|
||||
aliases: ["/personal/beulrogeu-geulsseugineun-neomu-himdeuleo/"]
|
||||
---
|
||||
|
||||
|
||||
야심차게 티스토리 블로그를 만들어 몇몇 글을 쓰고 나서, 한참동안이나 글을 쓰지 않았다. 하지만 나중에 돌아보면 쓰일 곳이 있지 않을까 하여 내 소장을 위해 Ghost + Vultr로 넘어왔고, 돈도 내야 하니까 글을 조금씩이라도 쓰지 않을까 생각했지만.... 결국 글을 쓰지도 않은 채 달마다 돈만 나가고 있다...
|
||||
|
||||
|
||||
|
||||
블로그 글을 왜 쓰지 않았지..? 고등학교 생활을 하느라 힘들고 바빠서 (노느라) 글을 쓰지 않았을 수도 있고, 마땅하게 글을 쓸만한 소재도 없고, 마땅하게 글을 쓸 기기 또한 없다. 나에게 있는거라고는 집에 있는 아버지 노트북과 내 아이폰 밖에 없으니까..
|
||||
|
||||
그래도 일기같은 형식으로 글을 써 내려갔다면 좋을 것 같은데 그 역할을 트위터가 하고 있는 바람에 더욱 쓰지 않게 되었다. 물론 길게길게 회고록을 쓰거나 감상을 쓰거나 후회를 하기 위해서라면 블로그만큼 좋은것도 없기는 한데, 나는 타자가 느리고, 글을 너무 못쓴다. 이과생특
|
||||
|
||||
하지만 애초에 내가 코딩을 하지 않은것도 몇달째 되어가고 있고, 내가 아이패드나 노트북을 구매하지 않는 이상 글을 절대 꾸준히 쓸 수 없을 것 같다. 물론 아침에 일어나면 남는 자투리 시간을 이용하여 글을 틈틈히 쓸수도 있지만, 역시 그 역할을 트위터가 하고 있다.
|
||||
|
||||
글쓰기가 너무 힘들다. 다른 블로그들을 보면 글도 길고 길지만 쉽게 읽히며 뭘 말하고 싶은지 탁탁 이해가 쉽다. 하지만 내가 글을 쓰자니 길제 쓰기도 힘들고 시간도 걸리고 머리도 아프고 할 이야기도 없다.
|
||||
|
||||
글을 쓰고 싶다. 멋지게 글을 쓰고 싶다. 다른 사람에게 도움이 되는 글을 쓰고 싶다. 내 글을 가지고 사람들이 기꺼이 대가를 지불할 만큼의 가치를 가지는 글을 쓰고 싶다. (그 대가란, 그 사람들의 시간..)
|
||||
|
||||
열심히 해봐야 겠다. 앞으로 대학 입시까지 2달 적게 남기도 했고, 내 몸이 망가져가는 걸 많이 실감했기에 건강하고 규칙적인 생활습관을 가지려 하고 있고, 그 첫걸음이 일찍 자서 일찍 일어나고, 남는 시간에 글쓰기이다.
|
||||
|
||||
화이팅! 할 수 있다..!
|
||||
|
||||
|
||||
|
||||
16
content/personal/2021-10-23-datacenter.md
Normal file
16
content/personal/2021-10-23-datacenter.md
Normal file
@@ -0,0 +1,16 @@
|
||||
---
|
||||
date: 2021-10-23T08:15:14.000Z
|
||||
description: ""
|
||||
draft: false
|
||||
title: 데이터센터
|
||||
---
|
||||
|
||||
구글같은 검색엔진이 늘어나고, 다양한 기업들과 서비스들이 사용자들의 개인정보와 데이터를 마구 수집한다. 이로 인해 생겨나는 기하급수적인 양의 데이터들을 보관할 스토리지와 그것들을 사용할 수 있는 데이터로 가공하기 위해 필요한 수없이 큰 컴퓨팅 파워를, 큰 기업들이 대형으로 지어놓은 데이터 센터가 담당하고 있다. 게다가 이제는 작은 기업이나 서비스들은 AWS나 GCP, Oracle과 같은 서비스를 통해 Cloud로 Computing하기까지 하니, 아마존이나 구글의 데이터 센터는 얼마나 커다랗고, 커다래야 하는지 알 수 있다.
|
||||
|
||||
아마존과 구글의 데이터센터뿐 아니라 네이버, MS, 오라클, 및 작은 데이터센터들이 지어질때 중요하게 작용하는 것이 있다. 발열과 전력문제이다. 어디보다도 전력을 사용하여 열이 덥혀질 시설이 겨울만큼 춥다는 것으로 얼마나 냉각시스템이 신경쓰는지 알 수 있다. 심지어 우리집에 있는 노트북만 사용해도 80도 가까이 올라가고, 방이 더워지는데 수백, 수천, 수만대의 컴퓨터가 설치되어있는 데이터센터는 오죽할까. 연료를 태워 그 열기로 전기를 만들고 그 전기를 다시 열로 바꾸고, 그 열을 내보내기 위해 또 다시 전기를 쓰다니.
|
||||
|
||||
나도 집에 작은 서버 하나를 운영하고 있다. 매달 받는 전기세가 가히 신비롭다. 그리고 방도 매우 덥다. 한대로 이 정도인데, 데이터센터는 엄청난 전기를 먹고 있다. 게다가 요즘에는 비트코인 열풍이 불어서 채굴이 한창 떠오르고 있다. 어떻게 보면 채굴장도 하나의 데이터 센터라고 볼 수 있지 않은가. Visa나 마스터카드와 같은 카드사들의 데이터센터가 각 나라로 각 개인으로 분산되어 분포하는 것과 비슷하게 볼 수 있으니 말이다. 이러한 와중에 전력이 부족해지고 있다는 뉴스가 자주 떠오른다.
|
||||
|
||||
그 많은 데이터센터의 대부분은 아마 인텔 제온 프로세서, 하드 디스크와 엔비디아의 그래픽카드를 구축해 놓았을 것이다. MS의 Bing 데이터 센터는 FPGA를 이용해 조금 더 성능을 높였다는데, ASIC이나 FPGA를 이용한 데이터센터도 많을 것 같다. 다들 전기를 많이 먹는 장비들이다. 뭐 ARM이나 RISC를 사용한다던가, Bing처럼 FPGA를 이용하던가.
|
||||
|
||||
사실 전성비가 좋은만큼 서버 프로세서만큼의 성능이 나오지 않겠으니 그 정도의 성능을 낼 정도의 대형 프로세서는 나오기 힘들 것 같다. 아직까지 모바일로 사용하는 이유기도 하고. 하지만 괴물급 기업들이 ARM 개발을 위해 한창 노력중이니. 엔비디아도 ARM코어로 데이터센터 개발중이라 하고, 그 애플이 ARM으로 노력중이니 곧 데스크탑급 되는 시스템이 나오고, 좀 있으면 서버급도 나올 수 있지 않을까 기대하고 있다. ARM 는 극강의 전성비를 고려한 설계인 만큼 물량으로 밀어붙여도 x86에 전력으로는 이길지 않을까 싶다. 서버에서는 코어수도 중요하게 작용하니까 다중코어로는 훨씬 유리하지 않을까 싶다.
|
||||
16
content/personal/2021-10-23-privacy.md
Normal file
16
content/personal/2021-10-23-privacy.md
Normal file
@@ -0,0 +1,16 @@
|
||||
---
|
||||
date: 2021-10-23T08:31:52.000Z
|
||||
description: ""
|
||||
draft: false
|
||||
title: 개인정보
|
||||
aliases: ["/personal/gaeinjeongbo-privacy/"]
|
||||
---
|
||||
나는 구글이 싫었다. 구글에 반대하며 지메일도 거의 쓰지 않고 있고, 다른 구글 플랫폼을 벗어나 다른 플랫폼으로 옮기고 있다. 하지만, 아이폰으로 옮기고 나서 몇주간을 생각해보니 내 분노의 대상은 구글이 아니라 애플이여야 한다는 것을 알게 되었다. 카카오, 구글에 가지고 있던 분노의 이유가 애플이라는 기업 자체를 강타한다. 물론 나도 알고 있었고, 구글 못지 않게 애플을 싫어하고 있었다. 새롭게 휴대폰을바꿀 때에도 OS만 구글이고 제조사는 다양한 (삼성이..겟지만..) 안드로이드 휴대폰과 휴대폰 하드웨어, 악세사리, OS, 결제, 게다가 웹엔진까지 제한하고 독점해버린 애플과는 비교가 된지 않는다고 생각했고, 이번에 플립이 잘 나와서 그것으로 바꾸려 했다. 물론 에어팟 수리를 하러 갔다가 아이폰에 홀리듯이 들어가버렸다. 한동안 애플의 통합 생태계의 편리함에 매료되어 내가 빅테크 기업에 어떤 이미지를 가지고 있으며 어떤 불만과 어떤 사상을 가지고 있는지 잊었었다.
|
||||
|
||||
하지만 이 문제는 구글이나 애플만의 문제가 아닐 것 같다. 따라서 애플과 구글만을 싫어한다고 해서 해결될 문제가 아니다. 이건 모든 빅데이터 산업과 모든 데이터 기업들이 가지고 있는 문제이고, 현대 사회에서 피할 수 없는 문제인 것 같다. 개인에 맞추기 위해, 광고주와 개인을 동시에 만족시키기 위해선 개인정보의 수집이 불가피하다. 최소한의 개인정보 수집이라 해고 결국 수집해야 하는 개인정보는 한둘이 아니다. 따라서 우리는 우리의 개인정보에 대해 어떤 것을 기업에게 주고 어떤 것을 주지 않을지 선택할 권리가 있어야 하고, 선택에 신경써야 한다. 특정 앱을 잘못 설치했다가 지금 모습이 데이터센터에 축적되고 있을 수도 있으니까. 이러한 점에서 개인의 Privacy 선택권을 최대한으로 존중하는 애플은 본받을 만 하다. 애플이 선구적으로 도입한 Ask app not to track이나 앱별 개인정보 관리, 카메라 사용과 마이크 사용 표시는 안드로이드에서도 도입하려 하고 있으니까 이건 정말 잘했다고 생각한다. 애플은 광고 받는 장사가 아니니까 할 수 있는 거겠지만 말이다.
|
||||
|
||||
하지만 구글은 태생이 검색엔진이고 광고 받는게 중요하고 가장 큰 수입원인 기업인 만큼 개인정보 수집에 가장 신경써야 하면서도 가장 필요한 기업이다. 앞으로 어떻게 할지 궁금하다.
|
||||
|
||||
이런저런 이유로 그래서 아이폰을 사용한다. 앱 트래킹은 다 차단했고, 마이크는 아예 꺼놨다. Private Relay도 잘 쓰고 있다. 하지만 매일매일 구글을 사용하고, 어쩔 수 없이 트래킹이 발생할 수 밖에 없다. 따라서 우리는 개인정보를 흘리고 다니지 않고 꽉 매고 다니는게 중요하다. 계정 보안과 로그아웃은 당연히 중요하고, 무분별하게 계정 연동을 하거나 가입하는 것도, 공개된 웹 상에 자신의 전화번호나 주소, 이메일 주소들을 과도하게 공개하지 않는것도 중요하다.
|
||||
|
||||
HTTPS 연결 확인도 중요하고, WiFi가 믿을 만 한지, 이 네트워크가 믿을 만 한건지도 중요하다. 신경써야 할 게 많지만 철저히 익명으로, 해킹당하지 않을 예방법을 생각하면 쉽다. 개인정보 보호와 해킹 방지는 방법이 비슷하다. 주의해야 할 것은 믿을 만한 곳에 흘리는 개인정보이다. 구글이나, 네이버. 믿을 만 하지만 가장 필요한 회사이다. 가장 이용해먹는 회사이고. 이 점만 주의한다면 일반적으로 자신의 개인정보를 관리한다고 할 수 있지 않을까..?
|
||||
17
content/personal/2021-10-23-what-am-i-doing.md
Normal file
17
content/personal/2021-10-23-what-am-i-doing.md
Normal file
@@ -0,0 +1,17 @@
|
||||
---
|
||||
title: 나는 무엇을 하고 있는걸까
|
||||
date: 2021-10-23T08:52:15.000Z
|
||||
description: ""
|
||||
draft: false
|
||||
aliases: ["/personal/나는-무엇을-하고-있는걸까/"]
|
||||
---
|
||||
|
||||
|
||||
프로그래밍에 매력을 느껴 프로그래밍에 입덕하게 된 건 2학년때쯤.. 이후 그 재미를 느끼고 많은 것들을 시도해보곤 했다. HTML과 CSS를 배워 가장 기본적인 웹사이트를 만들고, 이를 더 화려하게 꾸미기 위해 JS를 공부했다. 이를 배포하기 위해 서버 구축에 대해 공부했고, PHP나 MySQL을 이용해 기능성을 부여하면서 DB와 SQL에 대해 공부했다. 이후 고전적인 서버를 넘어 SSR이나 CSR에 대해 알아보려 NodeJS를 공부했다. 학교 입학시 과제였던 C로 하는 PS를 하면서 C나 C++에 관심을 가졌고, 왜 C로 코딩하는데 C++를 써야하는지 의문을 가지고 C++을 공부했다. C++이 완전히 다르다는 것에 충격을 먹었고, 이후 비슷한 객체지향에 대해 알아보며 Python에 입문했다. C에 비해 너무 쉬운 코딩과 너무 간단한 개발에 충격을 먹었고, PS하는데만 쓸 수 있던 C와는 다르게 다양한 분야에 접목하기 너무나도 쉬운 Python은 나를 개발 세계에 빠뜨렸다.
|
||||
|
||||
Python의 다양한 모듈을 사용하며 Requests와 같은 웹을 다루는 모듈을 쓰며 대체 웹은 어떤 구조일까 의문이 들어 네트워킹이나 HTTP, HTTPS에 대해 공부했고, 이런 것들을 응용해 나가며 실질적인 코딩에 가깝게 가면서도 주어진 기능 외로 작동하게 만드는 것에 맛을 들려 해킹에 대해 점점 흥미를 가지기 시작했다. Python은 빠르게 무언가 기능하는 하나의 완성품을 만들기 너무 적당했고, 실행했을 때 원하는 대로 작동했을 때의 쾌감에 빠져버렸다. 이후 생각나는 아이디어란 아이디어는 다 파이썬으로 구현했고, 나 자신의 아이디어 뿐 아니라 주변의 아이디어를 신경쓰게 되었고, 그게 학교 서비스 구현 프로젝트로 이어졌다. 파이썬으로 간단하게 했던 것들을 친구들이 노가다로 하는 모습을 보고 아 저거 파이썬으로 할 수 있겠는데라고 생각했고, 그렇게 만들어본게 수십개는 될 것이다. 한편으로는 내 호기심에 딱 알맞게 점점 깊은 곳으로 내려가고 있었다. 원리의 원리를 계속 파고들며 컴퓨터 구조까지 내려갔고, 내려가면서 다른 땅굴을 파는 게 너무 재미있었다. 해킹이.
|
||||
|
||||
결국 반도체까지 내려가서 더 이상 이해할 수 없을 때까지 내려갔고, 해킹은 더 이상 내가 알던 해킹이라는 학문이 아니게 다 통합되었다. 해킹을 할 수 있던 원인중 대부분 그 아랫단계에서 기초된 버그였고, 아래로 내려갈수록 하나로 합쳐졌다. 그래서 내가 읽은 책을 살펴보면 다양한 분야가 많이 있지만 다 상하관계로 얽혀있음을 알 수 있다. 네트워크에서 기초해서 TCP/IP로, 거기서 물리계층인 데이터 통신까지, 그리고 신호처리와 신호를 처리하는 소자까지 이어져 있다.
|
||||
|
||||
관심사에 따라 공부해서 재미있게 공부했고, 관심사에 따라 공부하니 꼬리물기 공부가 가능했다. 서로 얽혀서 각자의 이해를 도왔고, 서로의 흥미를 돋구었다. 그냥 '컴퓨터'라는 분야 하나가 너무 재미있었고, 나에게는 천직이라고 생각됐다. 전체가 재미있으니 가장 기초인 '반도체'나 '컴퓨터 구조'가 자연스럽게 내 진로이자, 내 주요 관심사가 되었다.
|
||||
|
||||
21
content/personal/2021-10-30-electronic-control-security.md
Normal file
21
content/personal/2021-10-30-electronic-control-security.md
Normal file
@@ -0,0 +1,21 @@
|
||||
---
|
||||
date: 2021-10-30T07:17:47.000Z
|
||||
description: ""
|
||||
draft: false
|
||||
title: 전자 제어 세계의 보안
|
||||
aliases: ["/personal/jeonja-jeeoyi-segyein-mirae-geu-boanyi-wihyeob/"]
|
||||
---
|
||||
|
||||
|
||||
미래 사회에는 전기자동차와 자율주행 자동차가 성하게 유행할 것이다. 사람 운전자의 역할이 거의 축소되고, AI나 전자적으로 제어될 것인데, 지금도 많이 일어나고 있는 논란은 바로 보안이다. 만약 자율주행 자동차가 해킹을 당하게 된다면 어떨까? 해커는 자동차에 타고 있는 사람의 생사여탈권을 가지게 될 정도로 심각한 문제가 있는 것이다. 그러므로, 이러한 생활환경에 직접적인 영향을 주는 전자기기의 보안은 매우 중요한 것으로 판단된다. 미래에 우리의 생활을 가장 많은 부분 담당할 사물인터넷도 마찬가지이다. 우리의 생활과 강하게 연관되어 있고, 그러므로 보안이 가장 주요한 요인이 된다. 전자적으로 제어되는 보일러가 해킹당하면 어떻게 될까? 해커는 보일러를 과하게 제어함으로써 실 사용자에게 영향을 미칠 수 있다. 더 심각하게는 가스밸브나 의료 기기가 누군가의 악의대로 조종된다면 사용자를 죽음의 위기에 처하게까지 할 수 있다. 에어컨이나 히터, 그리고 화장실, 환풍기, 및 여러 가구들이 연결되어 있으며, 우리의 삶에 큰 영향을 미칠 수 있다. 실제로 IoT기기들에 대해 우리의 사생활의 침해도 문제가 된다. 미래 사회에서는 모든 기기가 연결되어 있을 것이며, 자동차나 버스, 그리고 비행기까지도 무선으로 연결되어 있을 것이다. 그러면 여기서 가장 문제가 되는 것이 무선통신의 보안이다. 무선통신은 유선통신과는 다르게 모든 사람들이 시호를 감청할 수 있기에 그 보안이 매우 중요하고 심각하게 느껴진다. 그렇다면 이러한 사항들에 대해 지금은 어떻게 보안이 이루어졌으며, 또한 앞으로는 어떻게 발전되어야 할까?
|
||||
|
||||
첫번째로는 AI상의 보안이다. 지금 보안의 상황으로는 공격자들이 시스템에 대해 예측이 어려운 신종 변종 공격을 많이 진행하고 있다. 이것의 바탕이 되는 기술은 바로 자동화이다. 보안이라는 것 자체가 공격 시 대응 및 방지가 주요한 특징이기 때문에 자동화나 변종 공격에 대해서는 취약할 수 밖에 없다. 완벽한 시스템이란 없는 것이다. 이런 공격에 대처하는 방안으로는 인공지능을 사용하는 방법이 있다. 실제 대규모로 전송되는 공격의 경우 인공지능으로 해킹에 대한 지도 및 비지도 학습을 통해 해킹 패턴을 자동적으로 분석해 막아줄 수 있기 때문이다. 또한 악성코드 분석에 인공지능을 접목시키면, 실제 사람이 분석하는 것보다 더욱 빠르게 분석할 수 있다. 하지만, 인공지능 보안에도 문제가 있다. 특히 인공지능은 실제 보안에 의지하는 것이 아니기 때문에 과하게 보안하거나 또는 이미 일어난 데이터들의 경향성 때문에 제대로 된 예측을 못하는 것이다. 인공지능도 선입견이 있는 것이다. 이와 관련지어서 인공지능에 의한 해킹을 고려해 보아야 한다. 인공지능 자체가 해킹을 하는 것이다. 해킹이란 것 자체가 반복성이 중요하고 난수성이 중요하기 때문에 이와같은 작업에 인공지능만큼 딱 맞는 것은 없을 것이다. 이와같은 공격에는 인공지능에 의한 대처밖에 답이 없는 것이다.
|
||||
|
||||
인공지능에 의한 해킹과 보안에 대해 알아보았으니 인공지능 시스템에 대한 보안을 어떨까? 이것이 이에서 언급했던 자율주행 자동차에 관한 보안이 될 수 있다. 기본적으로 업다운 인공지능이 아닌 다운업 인공지능인 현재의 인공지능으로서는 주어진 데이터가 가장 기초적인 원리로 작용한다. 데이터를 기반으로 학습하고 행동하기 때문에 데이터의 정확성이나 신뢰성이 중요하게 작용한다. 이때 문제가 될 수 있는 것이 데이터의 오염이다. 데이터를 인위적으로 조작하여 인공지능의 행동을 조작하는 방법이다. 인공지능이 해킹당하기 쉬운 (어떤 방면에서) 이유가 바로 이것이다. 데이터가 악위적인 방향으로 조작된다면 인공지능의 행동의 패턴을 유추할 수 있고, 또한 자율적으로 조작할 수도 있다. 따라서, 인공지능에 대해서는 데이터의 유입의 신빙성을 중요시하게 고려해야 할 것이며, 데이터의 무결성이나정확성에 검증을 위한 인공지능을 도입하여 방어를 한다고 한다.
|
||||
|
||||
두번째로는 사물인터넷에 대한 보안이다. 사물인터넷은 실질적으로 우리의 생활과 밀접하게 관련이 있고, 가장 많은 전자기기가 이 기술에 접목될 것이기 때문에 가장 중요한 보안이라고 생각할 수도 있다. IoT, Internet of Things는 기본적으로 인터넷에 대한 기술이기 때문에 가장 보안에 취약해 질 수밖에 없다. 또한 IoT기기는 저전력과 저성능이 가장 중요하고 소형화가 중요하기 때문에 특별한 보안 솔루션을 도입하기가 어렵다. 집에 커다란 보안서버를 하나씩 구비해 놓지 않는 이상. 따라서 IoT의 경우는 해킹에 가장 취약하면서 해킹에 있어서 가장 위험한 존재이다. 그 누가 자신의 집에서의 모습을 전 세계로 생중계되기를 원하겠는가.
|
||||
|
||||
따라서 IoT에 대한 보안 솔루션은 굉장히 후발적일 수 밖에 없다. 따라서 소프트 웨어적으로 강력한 솔루션을 집어넣거나 취약점을 분석하게 후에 조치하는 방법밖에 없다. 전 세계적으로 IoT기기에 대한 보안 규제를 강화하거나 보안 기준을 제시하고 있고, 이를 처리하거나 대처하는 인력이나 전략을 제대로 정비하기만 한다면 현재 가능한 보안 솔루션 중 가장 상위의 솔루션이지 않을까 싶다.
|
||||
|
||||
이와 같이 우리의 삶과 인터넷, 전자기기가 밀접하게 연결될 수록 그 보안의 영향력은 비약적으로 커진다. 보안 업계나 기업들은 이 점을 유의하여 서비스를 제공해야 할 것이다.
|
||||
|
||||
27
content/personal/2023-10-23-operating-mirroring-server.md
Normal file
27
content/personal/2023-10-23-operating-mirroring-server.md
Normal file
@@ -0,0 +1,27 @@
|
||||
---
|
||||
title: Operating Mirror Server/HomeLab
|
||||
date: 2023-10-23T09:45:50.000Z
|
||||
description: operating-mirroring-server
|
||||
---
|
||||
|
||||
미러링 서버는 21년 말에 학교에서 우분투를 설치하다 너무 오래걸려서 만든거였는데, 그게 어느새 서버 업그레이드도 몇번 거치고 다른 것들도 추가하고 하니까 사이즈가 많이 커졌다. 작년까지는 에러도 자주나고 그랬는데 이제야 안정적으로 운용할 정도의 수준은 된 것 같다.
|
||||
|
||||
미러링하는 스크립트는 옛날 단순하게 적었던걸 그대로 쓰고 있다. path도 지정 못하고 하드코딩 투성이라 새로 짜야겠다고 생각은 했는데, 그래서 최근에 아에 다시 만들었다. 근데 이게 미러링 사이즈가 18TiB정도 되니까 이걸 테스트 해보기가 겁나더라.. 게다가 라이브로 뭔가 꼬여버리면 여기저기서 큰일이 나니까 Consistency가 중요한 바람에 테스트도 못하고 그냥 방치하고 있다.
|
||||
|
||||
미러링 하는 서버가 NFS로 마운트하는 방식이라 비슷하게 다른 서버에서 Overlay로 설정해서 테스트를 해보기는 했다. 그때는 딱히 큰 문제가 없었지만 나중에 실제 돌릴때 혹여나 예상하지 못한 곳에서 문제가 생기면 많이 골치아파진다. 지금 쓰고 있는 스크립트는 1년 넘게 달 돌아가고 있으니 말이다. 단순히 YAML로 된 Config를 읽어서 Rsync로 동기화 한 뒤에 Index만 업데이트하면 되는 스크립트라 복잡한건 없는데, 여기저기 예상치 못한 곳에 에러가 나는 바람에 에러 핸들링에 꽤 애를 먹었다.
|
||||
|
||||
그래도 이거 만지면서 꽤 많은걸 배웠다. 물론 서버 만지면서 리눅스는 뭐.. 그렇고 (애초에 노트북이 리눅스라..) 쉘스크립트랑 템플릿팅이랑 웹 사이트 정적 디자인도 몇몇개 알게 되었고,, 특히 뭐랄까 개발 외적으로 책임감?도 약간은 느끼게 된듯 하다.. 내 서버가 잠깐 문제생기면 여기저기서 문제가 터지고 수습하는것도 꽤 힘드니까 말이다..
|
||||
|
||||
아 맞다, 오늘 Kali 리눅스 공식 미러에 추가되었다. 일주일쯤 전에 트친분께서 Kali 미러가 너무 느리다고 하셔서 확인 해봤는데, 한국에 없어서 대만이랑 일본에서 가져오는거 아니던가.. 한국 인터넷이 바다 건너면 속도가 1/4토막이 나는 바람에 심각하게 느리겠다 싶었다. 그래서 Kali 미러링 공식 문서를 읽어 봤는데, 다른 미러는 보통 4시간에 한번 이렇게 시간으로 동기화를 하는데 요거는 SSH Pushing을 쓰는 것이었다. 동기화가 필요할 때 (메인 미러가 업데이트 되고 나서) SSH로 각 서버에 신호를 보내 동기화를 하는 방식이다.
|
||||
|
||||
SSH를 Kali 서버로만 열고, Authorized Keys 파일에 Public Key와 "command="를 입력해 두면 그 키로 인증한 클라이언트는 정해진 "command="가 실행된 환경만이 주어진다. 물론 Kali에서 제공한 스크립트도 다 오픈되어 있는 스크립트이고, 나도 한번 확인해본 스크립트지만 여튼 SSH를 타인에게 연다는 게 약간 걱정이 되었다. 아무래도 서버 권한을 남에게 주는거니까 혹여나 그쪽 PrivKey가 유출이 되거나 하면 문제가 되니까 찜찜하기는 했는데, 뭐 별 수 없다 싶었다.
|
||||
|
||||
이것도 그쪽에서 도메인이 아니라 IP로 고정해둬야 하는 방식이듯 해 Dynamic IP는 안된다고 했는데, 이거는 VPS에 연결해서 SSH Shim 비슷하게 설정하는걸로 해결했다. VPS IP는 고정이니까 그 서버를 거쳐서 내 로컬 서버로 들어오게 설정해놨다. 이렇게 하는 바람에 이제 VPS가 Dependency로 남아버렸다. 내가 서버를 아마 앞으로 평생 해놓을 것 같으니 저 IP도 평생 달에 5불씩 내면서 유지를 해야한다. 이것 이외에는 값싸게 고정 퍼블릭 IP를 받을 방법이 없다. 데이터센터는 트래픽이 너무 비싸고, 트래픽이 싸더라도 로컬 NFS를 써야하니까 실제 서빙 대역폭의 두배가 필요하다. 계산해 보니 달에 평균적으로 14-15TiB정도 쓰는데, 이거 VPS에서는 한 5-60불이라 부담이 좀 된다.
|
||||
|
||||
아웃바운드 트래픽이 14-15TiB나 되니 ISP에 헤비업로더로 등록?된듯 하다. 아무래도 가정용 회선을 써야 하니까 ISP의 제한을 조금 받는데, 가끔 DHCP도 안주고 레이턴시도 늘어지고 해서 짜증이 난다. 근데 어차피 아웃바운드는 한 80%가 국내니까 어차피 ISP 내부 망 안일텐데, 이러면 왜 굳이 제한을 하는건지 잘 모르겠다. 솔직히 국내 ISP는 국내에서라도 QoS를 없애야 하지 않나 싶다. 150GiB는 요즘같은 시대에 너무 적은 용량이다.
|
||||
|
||||
초기에는 많은 사람들이 쓰지는 않아서 왜 굳이 아무도 안쓰는 서버를 계속 켜놓을까 생각이 들었는데, 요즘 들어 몸집도 커지고 트래픽도 팍팍 올라가니 할 맛이 난다. 특히 외부에 있는 다른 머신에서 (학교에 설치되어 있는 우분투라던지) 내 서버가 보이면 정말 기쁘다. 처음에는 커뮤니티를 위해서 하는거 보다는, 취미로 하는 부분이 컸는데, 지금은 커뮤니티에 조금이나마 보탠다는 생각이 좀 강해졌다. 물론 아직도 내 유일한 취미는 서버 운용과 오픈소스 기여다. 요새 프로그램을 만드는거에 노하우도 생기고 해서 꽤 완성도 있는 결과물도 많아졌다.
|
||||
|
||||
이제 남은 해보고 싶은 거는.. 러스트를 배우는거다.. 뭐랄까 내 머리는 C에 테일러되어 있어서 말이지, 러스트의 엄격함에 원초적인 거부감이 든다. 항상 C의 자유도를 바탕으로 꼼수를 쓰는 방식을 꽤 애용해서 그런지 마음대로 못하는 러스트는 별로다.. 그래도 C의 Proceeder기도 하고, 또 메모리 보호는 필요불가결한 부분이니까 적응해 나가야지 싶다.
|
||||
|
||||
카이스트 미러는 있는데 왜 우리 학교는 미러를 안하지.. 동아리방 가보니까 안쓰는 서버 있더만..
|
||||
17
content/personal/2400-06-23-school-projects.md
Normal file
17
content/personal/2400-06-23-school-projects.md
Normal file
@@ -0,0 +1,17 @@
|
||||
---
|
||||
date: 2400-06-23T00:49:00.000Z
|
||||
description: ""
|
||||
draft: false
|
||||
title: 학교에서 했던 프로젝트들..
|
||||
aliases: ["/personal/haggyoeseo-haessdeon-peurojegteudeul/"]
|
||||
---
|
||||
|
||||
|
||||
1. 귀가시간 수집 프로그램
|
||||
2. 기상곡 수집 프로그램
|
||||
3. 컴퓨터실 사용현황
|
||||
4. 학교 내부 정보공유망
|
||||
5. 문서파일 자동저장 및 복구 시스템
|
||||
6. 학교 저지 사이트 API 정리 및 제출시스템 프록시
|
||||
7. 선생님들이 부탁하셨던 수많은 프로그램들
|
||||
|
||||
25
content/personal/2999-04-14-wrong-choice.md
Normal file
25
content/personal/2999-04-14-wrong-choice.md
Normal file
@@ -0,0 +1,25 @@
|
||||
---
|
||||
date: 2999-04-14T15:55:00.000Z
|
||||
description: ""
|
||||
draft: false
|
||||
title: 선택실패
|
||||
aliases: ["/personal/2022041406/"]
|
||||
---
|
||||
|
||||
|
||||
고등학교 3학년 때까지만 해도 나는 무조건 컴퓨터 공학과나 전기전자 공학과. 학과만 보고 대학교에 진학하리라 마음먹었었다. 진짜 학교 이름은 절대 보지 않을 것이라 생각했다. 하지만 막상 입시에 처하고 선택의 갈림길에 있으니 그 다짐은 물거품이 되었다.
|
||||
|
||||
역시나, 아니나 다를까 원서 접수 기간이 되니 진로 담당 선생님은 실적을 위해 상위 대학교의 낮은 학과에 원서를 넣어볼 것을 추천하셨다. 말이 추천이지 반 강제로 넣게 되었다. 아무런 관심도 없었고, 3년동안 생각도 없었는데다 자기소개서도 짜맞춰야 쓸 수 있는 학과에 지원했다. 붙어도 안간다는 생각으로. 하지만 내가 희망했던 대학을 떨어지고, 상위 학교 하위 학과와 하위 학교 자유 학과중에 선택해야 했다. 내가 3년동안 해왔던 것과 내가 무엇을 하고 싶은지를 생각해 본다면 당연히 학과를 보고 진학을 해야 했었는데, 막상 상위 학교의 합격증을 받으니 당연히 마음 한켠에서는 이걸 버린다고?!?라는 마음이 있었고, 그 마음에 휘둘려 등록예치금을 보낸다. 아직 등록 기간이 남았으니 등록 취소를 해도 되겠지만, 사실상 마음을 다잡은 것이나 마찬가지였다. 등록금 환불 신청서까지 적어놓고 책상에 올려두었다. 도장과 보호자 서명까지 받아놓고 고민했다. 후회하지 않을까? 어느 쪽으로 가나 조금 다니고 후회하게 될텐데, 학교를 후회하는게 학과를 후회하는 것보다 더 심하지 않을까 생각해 결국 그대로 원서는 놔둔 채 날이 넘어간다. 날짜가 넘어가는 걸 보고 얼마나 힘이 풀렸는지 모르겠다. 이제는 돌이킬 수 없구나.
|
||||
|
||||
그런 선택을 한 후 몇일간은 대학교 이름에 심취해 우리 학과도 선녀처럼 보였다. 전망 좋은 공과 학과로만 보였다. 하지만 시간이 지나면서 심취해 있던 생각이 풀리기 시작했고, 학과의 현실을 마주하기 시작하면서 후회가 밀려왔다. 서양에서는 주로 취급하지도 않는 사양산업의 책임으로만 끌고 온 이름만 대학인 학과. 이게 우리 조선해양 공학과의 현실이었고, 미래였다. 미래도 없는 학과. 이런 학과인줄 알고는 있었다. 하지만 실제 전공 수업을 들으면서 더욱이 실감났다. 왜 이런 학교에 와서 이딴 옛날 정보를 배워야 하는가. 왜 교수님은 열등감에 산업을 과장하고 잘 될거라고 세뇌하고 애원하듯이 수업을 하실까. 그 정도로 사양산업의 학과라는 것을 깨닫게 되었고, 탈출을 결심했다.
|
||||
|
||||
결국 탈출을 결심하게 될 줄은 알았다. 반수를 하던, 유학을 결심하던, 군대를 가던 어떻게든 이런 현실을 벗어나고자 하게 될 것이란 것을 알고 있었다. 학교도 내가 생각했던 것처럼 엄청 막 좋은 곳은 마냥 아니었다. 역사가 오래되어 뿌리깊은 명문이지만 보수적 교육과 보수적 관념 그 자체인 학교인 듯 했다. 대학교 수업은 고등학교의 주입식 교육 그 연장선 뿐이었다. 많은 것에 너무 큰 상실감을 느꼈다. 학과에서도, 학교에서도. 그래서 결국 대한민국 교육의 한계인가 싶었다. 대학교도 같은 처지의 교육이구나 했다.
|
||||
|
||||
지금 학과에 대한 열등감으로 그렇게 느끼는 것일 수도 있다. 하지만 만약 ‘학과’때문에 학교도 그렇게 느껴진다면 그만큼 그 학과에 문제가 크다는 것이 아닐까?
|
||||
|
||||
난 유학을 결심했다.
|
||||
|
||||
대한민국의 교육을 벗어나고 싶다. 아직 기초를 공부하는 입장으로서 얼만큼의 주입식인 필요하다는 것은 인정한다. 하지만 이것이 대학원까지 이어지고 심지어 그 이상에도 이어지는 교육 체계와 대학 교수들 아래에서 배우고 싶지 않다. 난 이루고 싶은 꿈과 하고 싶은 일, 애타게 배우고 싶은 것이 있다. 지금까지 내가 노력할 수 있었던 사명감이라 할 수도 있다. 이것이 깨져버린 이상, 그리고 여기서 계속 공부를 이어나가는 이상 내 꿈은 영원히 짓밟힐 것이다. 지금 여기에는 어떤 수를 써도 그것을 이룰 수 있는 길은 없다고 생각한다. 누구는 회피라 할테지만, 난 여기에서는 내가 할 수 있는 능력의 최선을 다했다고 생각한다. 과거를 후회하면서 이뿐인 자리에 있느니, 차라리 이 현실을 회피해 새 길을 열어나가련다.
|
||||
|
||||
제일 중요한 것은 이것이 지금 하기 싫은 일에 대한 회피가 목적이 되어 버리면 안된다는 것이다.
|
||||
|
||||
41
content/personal/2999-12-01-college-admission-final-step.md
Normal file
41
content/personal/2999-12-01-college-admission-final-step.md
Normal file
@@ -0,0 +1,41 @@
|
||||
---
|
||||
date: 2999-12-01T17:09:00.000Z
|
||||
description: ""
|
||||
draft: false
|
||||
title: 대학 입시가 한단계만 남았다.
|
||||
aliases: ["/personal/daehag-ibsiga-handangye-namassda/"]
|
||||
---
|
||||
|
||||
|
||||
대학 입시가 한단계만을 앞두고 있다.
|
||||
|
||||
합격자 발표와 등록.
|
||||
|
||||
뭐 공부하고 대비해야하는 시험은 다 끝났으니 마음껏 놀고 있지만 마음의 한편에는 아직 불안함이 많이 존재하고 있다. 또 공부와 시험대비라는 정해져 있는 계획만을 12년 동안 따르던 나에게서 갑자기 계획이나 강제성이 사라졌다. 이제부터는 내가 무엇을 할 것인지를 나 혼자서 알아서 결정해야 하고 또한 그 책임도 내가 져야할 것이다. 예를 들어 늦게자도 누군가 깨워주지 않는다는 것에서 그것을 처음으로 느꼈다.
|
||||
|
||||
지금 하고싶은 것도 없다. 무언가 해야하는 것도 딱히 없다. 그래서 그게 더 스트레스다. 운동을 해야할 걸 알고 운동을 하고싶지만 무엇부터 시작해야 할지 막막하다. 영어공부를 해야하는 것을 알지만 막상 하려니 하기 싫다. 운전면허는 학원을 다니므로 예외. 남겨놓은 책도 읽어야 하지만 눈에 들어오지 않는다. 모두 핑곗거리 뿐이지만 나에게는 하지 않을 충분한 계기가 된다.
|
||||
|
||||
마음가짐을 고쳐잡아야 한다. 미련하고 기계이기만 했던 지난 학생 시절을 벗어나 자율적으로 움직이는 어른, 하나의 사람이 되어야 한다. 이러고만 있을 수는 없다. 그래서 다짐을 했다. 내일부터는 사람이 되어보자.
|
||||
|
||||
그 다짐은 물론 다음날 아침에 깨졌다. 늦게 깨어난 것은 물론 일어나자 마자 의욕을 잃었다. 아직 나는 사람이 될 마음가짐이 안되었구나. 옛날만큼이나 아니 오히려 더다짐에 대한 마음가짐과 독기가 풀렸구나..
|
||||
|
||||
어쨋든 무거운 얘기는 여기까지만 하고 이제 앞으로의 계획을 정하든가 해야겠다.
|
||||
|
||||
일단 첫번째로 운전면허. 이번주 주말부터 시작해 매일 1시에 수업이 있다고 들었다. 1차 필기시험을 통과할 수 있도록 집중해서 듣자.
|
||||
|
||||
두번째로 운동. 입시하던 도중에 항상 입시 끝나면 다이어트 하고 헬스를 해서 몸을 건강하게 만들어보자! 마인드였는데 지금은 헬스는 개뿔 먹고 자고 눕기만 하고 있다. 하지만 오늘 뻘짓으로 2시간이나 걸어다녔으니 운동의 초석을 다진것이라 보고 내일부터 or 담주부터 헬스를 끊어야 겠다. PT를 끊던가 하면 식단도 조절되고 그걸 따르는 건 할 수 있으니까 해보자구!
|
||||
|
||||
세번째 영어. TOEFL. 토익말고 토플이 나에게는 익숙하다. 토플 주니어를 거의 매년 치다시피 했고 중딩때 IBT를 여러번 쳤으니 토플이 제일 익숙할 것이다. 일단 나는 기본 영어 감은 충분하고 넘치다고 자부하고 있..으니(???) 문법이나 문제푸는 요령같은 것들을 인강을 듣고 문제집을 풀고 해서 꾸준히 영어공부를 해야겠다. 뭐 많이는 못하더라고 꾸준히는 할 수 있잖아? 할 것도 없는데.. 일단 교재부터 알아보고 (뭐 해커스가 되겠지만) 인강도 알아보고 해서 책을 빨리 구입하던가 해야겠다.
|
||||
|
||||
네번째. 자산. 돈관리. 원래 내 통장은 어머니가 관리하셨다. 금액이 *만 가까이 되니 내가 건들기 힘든 금액이기도 했고, 세금때문에 마음대로 건들면 안된다고 했다. 하지만 만 17세가 되면서 내가 내 금융을 관리할 수 있게 되었고 그때 카뱅이나 씨티같은 계좌를 몰래 만들어 놨다. (나중에 씨티는 해지하느라 애를 엄청 먹었지만) 뭐 지금은 다 알지만.. 내가 쓰는 계좌는 카뱅, 토뱅 두개이다. 어머니가 만들어 놓으신 계좌는 농협에 여러개인데 나도 잘 모른다. 근데 내가 그 고액 저축통장을 찔끔찔끔 빼서 써서 약간 일이 커지게 될 것 같이 되어버리긴 했다. 그리고 문제는 내 경제관념이다. 어디다 빼먹고 왔다. 고3 주제에 한달 사용액이 50만원 가까이 된다. 이건 진짜 고쳐야 한다고 생각한다. 통장정리 하고 어머니께 잔소리 좀 들으며 자산관리에 대해서알아가야 겠다. 국가장학금도 있고 해서..
|
||||
|
||||
다섯째. 뭐 독서려나. 사놓고 안읽은 책이 90%이다.권수로 치면 대강 40권이고 금액으로 치면 대충 100만원 정도이네..? 빨리 읽어야 한다. 대학가기 전에 30권 이상 읽는게 목표이다. 하지만 어림도 없지. 기술서는 빼고 읽으면 그정도는 할 수 있을 것 같다. 독서는 마음의 양식! 나는 독서를 좋아한다.
|
||||
|
||||
여섯째 자기계발! 프로그래밍 공부, 컴퓨터 공부!? 파이썬은 많이 했고 C++도 기초는공부했다. 이제 두꺼운 C++책과 TAoCP, EMC++, 하드웨어 보안, 전기전자 등등 이런 책들 가지고 공부해야 겠다! 재밌겠구만!! 이런거 좋아함.. 요즘에는 코테도 많이 보는 듯 하니 알고리즘 공부도 해놓고 내가 좋아하는 보안 공부도 하고..
|
||||
|
||||
일곱째 인간관계 청산. 이게 좀 많이 필요할 것 같다. 일단 고등학교 3년을 100명이랑 보내서 안 친할래야 안 친할 수 없다. 그 중 도움이 될것 같은 친구가 있고 아닌 친구도 있지만 나는 현생에 충실하지 않았으면서도 충실했어서 대강 다들하고 이어져 있다. 이 상태 유지만 하면 좋을 것 같다. 내 주요 인간관계는 모 SNS의 분들과 몇몇 친구들이니..
|
||||
|
||||
이게 이걸 바탕으로 계획을 짜보자! 애들 공부하는 VLOG도 보면서 '나도 그랬었지' 와 '그랬었으니 지금도 가능'을 동시에 느낄 수 있다.
|
||||
|
||||
화이팅! 이제 끝이고, 이제 진정으로 새로운 시작이다!!!!!
|
||||
|
||||
39
content/personal/2999-12-22-high-school-retrospective.md
Normal file
39
content/personal/2999-12-22-high-school-retrospective.md
Normal file
@@ -0,0 +1,39 @@
|
||||
---
|
||||
date: 2999-12-22T01:23:00.000Z
|
||||
description: ""
|
||||
draft: false
|
||||
title: 고등학교 돌아보기
|
||||
aliases: ["/personal/godeunghaggyo-dolabogi/"]
|
||||
---
|
||||
|
||||
|
||||
2021년을 돌아보며.
|
||||
|
||||
2021.12.22
|
||||
|
||||
벌써 12월 22일이다. 12월달에는 열심히 살아야지 하던게 어제같은데 벌써 새해가 다가온다. 나는 내년 성인이 되지만, 아직 실감이 안난다. 술담배를 할 수 있는 나이라기 보다는 내 행동에 내가 책임져야 하는 때가 되었다는 게 더 실감이 난다. 대학을 고민하며 내가 앞으로 뭘 하면서 먹고 살아야할지 꽤 오랫동안 고심했는데, 그 결과로 조금 성장한 것 같아 이제와서는 약간 기쁘기도 하고 무섭기도 하면서 슬픈 약간 오묘한 기분이다. 어찌되었든 이제 성인이 되니까 조금 변해야겠다고 다짐하고 있다.
|
||||
|
||||
2021년을 돌아보면 2020년을 돌아봐야 하고, 그러면 당연히 2019년이 생각난다. 여튼 고등학교 3년 생활이었기에 항상 쌍으로 돌아다녀야지. 고등학교 생활을 돌아본다.
|
||||
|
||||
**2019년, 고등학교 입학.**
|
||||
|
||||
나는 초등학교 때부터 영재교육원을 다니면서 내 미래가 결정되다 싶이 했다. 이렇게 계속 하다보면 동네 중학교에 진학하여, 과학고를 준비하고, 과학고에 진학하여 과기원을 가는게 정해져있었던것 같다. 그때는 지금 이렇게 될지는 몰랐겠지만, 그 길을 모범적으로 걸어서 지금의 내가 되었다.
|
||||
|
||||
2018년 연말, 나는 과학고 입시를 봤다. 자기소개서를 쓰면서 학원에서 선생님과 친구들과 새벽 3시까지 남아 첨삭을 했던 기억이 있다. 불 꺼진 건물에서 술래잡기를 하면서 즐거웠던 기억이 있는데, 지금 돌아보면 즐거워서는 안되었것 같지만 중학생이니 그럴 수 있다고 생각한다. 그때쯤에는 학원에 12시까지 남아서 서류준비를 하고는 했는데, 이때 항상 데리러 와주셨던 아버지께 정말 감사하다고 이제와서 생각한다. 초등학교 6학년때부터 올림피아드를 준비하면서 매 주말마다 학원에 갔고, 내가 숙제를 안해서 학원에 늦게 남아야 했던 적도 많은데, 그럴때마다 항상 아무말 없이 데려다 주셨다. 영재원도 다녔기에 먼 거리를 항상 운전해 주셨다. 2주마다 창원에서 진주까지 가고, 거기서 4시간을 기다려주시고, 집에 데려다 주셨다. 이제와서 생각하니 정말 너무 감사하다는 말 밖에 안나온다.
|
||||
|
||||
서류를 통과하고, 면접을 준비해야 했다. 나는 말을 잘 못했다. 정확히는 너무 긴장을 하는 타입이었다. 평소에는 그렇게 시끄럽고 잘 놀았는데, 면접은 너무 긴장되었다. 그래서인지 준비하는데도 애를 먹었지만, 결과적으로는 잘 되었다. 뭐 통과했으니 말이다.
|
||||
|
||||
면접시험은 너무 못봤다고 생각했고, 그래서 면접을 보고 와서 공부를 했을 정도이다. 아무래도 고등학교를 간다는 낮선 감정과 못봤다는 불안감이 교차해서 잠깐 철이 들었나보다. 하지만 뭐 합격을 했고, 합격 페이지를 봤을 때 그 희열은 아직까지도 기억이 난다. 합격을 했어서, 나는 의욕이 붙었었다. 과고 대비반, 과고를 들어가기 전 방학때 잠깐 하는 총정리 수업을 정말 열심히 했었다. 아마 그정도로 열정을 가지고 공부했던 적은 거의 없던것 같다. 고등학교때는 열정이 아니라 강박에 의해서 공부를 했으니… 그때 물리와 수학, 화학을 한번 쭉 배웠는데, 수학은 둘째치고 그때 배웠던 화학 지식은 고등학교 3년동안 우려먹었고, 그때 배웠던 물리 덕분에 상위권?을 유지할 수 있었다. 정말 재미있었고, 원리가 신기했다. 정말 지금 생각해도 그때 새로운걸 배운다는 느낌을 다시 느낄 수 없을 것 같다. 여튼 방학동안 정말 열심히 공부했고, 덕분에 1학년때에는 최상위권을 할 수 있었다.
|
||||
|
||||
내가 진학하는, 과학고는 기숙사 학교였다. 이때 처음으로 집을 떠나 멀리서 생활하기 시작했다. 처음에는 정말 정말 무서웠다. 들뜬 감정도 있었지만, 중3 그 어린 나이에 집을 나온다는 건 아무래도 많이 불안했던 것 같다. 과학고는 브릿지라고, 입학 전에 2주간 두번 학교에서 미리 생활하면서 기숙사 생활과 고등학교 일상에 미리 익숙해지고, 미리미리 여러가지 시험을 치면서 각종 반을 결정하는 기간을 가진다. 2월 초 처음으로 브릿지를 가면 기숙사 방을 배정받고 생애 처음으로 룸메이트를 배정받았다. 생판 모르는 친구랑 같은 방에서 자고 생활해야 하는 거였는데, 나는 새 친구를 잘 사귀지 못하는 편이라 약간 두려웠다. 물론 말만 한번 트면 급속도로 친밀감을 좁히는 스타일인데, 그 처음 말을 트는게 힘들었다. 하지만 착한 친구였고, 덕분에 2주동안 여러 친구도 사귀고 잘 지냈다. 기억나는건, 우리 방에 귀신이 나오기로 알려진 괴담이 있는 방이었는데, 무서워서 몇일은 못잤던 기억이 있다. 기숙사 생활은 생각보다 괜찮았다. 첫날 빼고는 바로 익숙해졌다. 아침 6시 20분에 일어나는 것과 점호, 그리고 공동 샤워실에서 씻는것이 정말 낮설었지만 성격상 금방 적응했다. 너무 적응해서 문제지만.. 아침에 일어나서 운동장을 한바퀴 도는 구보를 하고 기숙사로 돌아와 씻는 시간을 가진다. 이후 아침 자습을 하는데, 이때 시험을 쳤다. 진단고사라고, 아마 자신의 위치를 확인해보라고 시행했던 시험이었던 것 같다. 아침에 머리를 굴리는건 낮설었고, 그때에는 그게 지대한 영향을 끼칠 것 같아 최선을 다해서 쳤다. 물론 두번째 브릿지에서는 잔다고 치지도 못했지만..ㅎㅎ
|
||||
|
||||
입학을 하고 정식으로 학생이 되었다. 방학때 공부했던 기세로 1학기는 정말 열심히 했던 것 같다. 아마 고등학교 때중에서 최고로 집중했던 시기이다. 덕분에 뭐 점수는 잘 받았고, 원하던 영재학급도 들어갈 수 있었지만 원하던 동아리는 떨어졌다. 시험이 처음보는 개념들 투성이었고, 부산이나 서울에까지 가서 공부했던 친구들과 싸움은 힘들었다. 이때 한계를 첨으로 느꼈다. 1학기 기말고사가 끝나고 고등학교 생활의 전환점이 찾아온다. 한 친구를 알게 된다. 중3때 나는 덕후.. 였다. 1학기때에는 공부하느라 바빠서 다른거에 신경쓸 겨를이 없었지만 처음으로 방학을 맞이하면서 여유가 생겼고, 자유시간이 많이지면서 약간은 문화생활을 즐기게 되었다. 이때 내 내면에 있던 잠재력이 부활을 했고, 그때 같이 덕후인 한 친구를 만나게 된다. 나랑 너무 잘 맞았다. 성격도 잘 맞았고, 관심사도 잘 맞았던 그 친구와 나는 급속도로 친해졌다. 그러다 우리는 연애를 한다. 그것도 중간고사 5일전에 사귀기 시작했다. 당연히 공부는 하지 않았고, 연애에 몰두하느라 2학기는 통으로 날리게 된다. 하루종일 놀고, 문자하고, 편지쓰고 그랬다. 단 둘이 있기 좋은 시골학교라 산책도 자주 갔고, 정말 행복했다. 성적이 많이 떨어졌다. 그래도 중위권은 유지했는데, 부모님은 당연히 당황하셨을 것이다. 갑자기 그렇게 성적이 떨어졌으니.. 그래서 결국 부모님과 틈만 나면 싸웠고, 그 친구와도 정말 자주 싸웠다. 지금와서 내가 왜그랬을까 싶다. 정말 좋은 친구였고 정말 잘 맞았는데, 내가 너무 잘못했던것 같다. 시간이 많이 흘러서 알게 되는건가 싶다. 그 친구와는 몇번에 다툼 이후로 영영 멀어지게 되었다.
|
||||
|
||||
한번 공부를 놓으니 그 뒤로 공부하기 어려웠고 낮아진 성적은 높이기 힘들었다. 그렇게 나는 2학년을 맞이했다.
|
||||
|
||||
**2020년에는..**
|
||||
|
||||
2020년 나는 2학년이 된다. 1학년 친구들이 새롭게 들어오며 2학년이 되었다는 것을 실감했다. 새롭게 마음을 다잡고 공부를 하기로 마음먹었다. 그나마 공부를 해서, 성적을 높이는 데에는 성공했다. 2학년 1학기를 잘 쳐서, 조기진학이 가능한 성적이 되었다. IQ도 140을 넘겨서 조기졸업도 가능했다. 2학년 여름방학때는 고민을 한다. 조기졸업을 할지 조기진학을 할지.
|
||||
|
||||
그 전에, 2학년에 올라가는 시기에 코로나를 맞이한다. 전 수업이 온라인 수업이 되었고, 입학식뿐만 아니라 진급식, 그리고 그 사이 수업도 전체 다 온라인으로 진행하게 되었다. 온라인으로 진행하면서 장비를 셋팅하기 시작했다. 내가 아침에 수업을 제대로 들을리 없었기 때문에 캡쳐보드며 다른 여러 장비도 장만했다. 그러면서 오디오 문제가 생겼다. 에어팟은 녹음을 하면서 동시에 재생할 때 통화로 연결이 되어 음질이 정말 너무 구리기 때문에 이를 해결하기 위해 오디오 장치를 따로 썼고, 캡처보드에 오디오를 넣기 위해 가상 오디오 드라이버까지 찾아가며 준비했다. 그러면서 오디오 드라이버에 관심을 가졌고, 그러면서 컴퓨터에 대해서 관심을 가지게 된다.
|
||||
|
||||
38
content/personal/2999-12-31-what-should-i-do.md
Normal file
38
content/personal/2999-12-31-what-should-i-do.md
Normal file
@@ -0,0 +1,38 @@
|
||||
---
|
||||
title: 나는 무엇을 해야 하는걸까나
|
||||
date: 2999-12-31T11:11:00.000Z
|
||||
description: ""
|
||||
draft: false
|
||||
aliases: ["/personal/나는-무엇을-해야-하는걸까/"]
|
||||
---
|
||||
나는 대학을 한번 떨어진 경험이 있다. 과학고등학교 재학생 중 중상위권이었던 나는 조기진학의 기회를 받았고, KAIST만을 넣은 채로 떨어졌다. 그 때는 붙을 줄 알고 있어서 2학년 2학기 시험을 말아먹었고, 지금도 그 영향을 받아 피를 흘리고 있다.
|
||||
|
||||
다행히 그 이후 각성을 한건지 철이 든건지 3학년 1학기는 최상위권 성적을 받아 원래대로 유지는 할 수 있었다. 3-4등 정도 했으니까 망정이지 태도를 안고치고 그대로 했더라면 나는 그대로 멘탈이 없어져버렸을 것이다.
|
||||
|
||||
오늘까지 자기소개서를 작성했다. 3번 대학별 지원동기를 쓰면서 계속 내가 하고 싶은 것이 무엇인지 내가 지금까지 무엇을 했는지에 대해 고민을 했다.
|
||||
|
||||
내가 항상 하던 생각. 무엇을 공부하던지 간에 항상 들었던 생각. 내가 무엇을 하던 나보다 잘하는 사람은 존재하구나. 특별한 존재가 되기에는 나는 너무나 작구나. 자신감이 점점 떨어지는 듯한 느낌이 들었다. 그래서 나는 나를 특별하게 만드는, 내가 돋보일 수 있도록 해주는 것들을 공부하자고 생각했다.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
나는 마구잡이로 공부했다. 필요할 때에만 공부했고, 원하는 것만 공부했다. 그래서 그걸 공부라고 해도 될 지 모르겠다. 일단 내 기억에서는 공부가 아니다. 나는 컴퓨터 공부를 취미정도로만 생각했지 공부라고는 생각하지 않았다. 그래서 항상 뭔가 컴퓨터를 공부하면 죄책감이 들고 공부한 것 처럼 느껴지지 않았다. 물론 재미있게 한 덕분에 지식은 방대해 졌지만..
|
||||
|
||||
FPGA에 대해 공부할 때에도 마찬가지였다. 공부였지만 내 마음 속에서는 공부가 아니라 딴짓으로 박혀있었다. 그래서 원하는 것을 알 수 있고 재미있게 할 수 있었지만 자세히 알고 집중해서 했다고는 못한다. FPGA를 공부했지만, 알고는 있지만 공부했다고는 할 수 없어서 결국 안한거나 마찬가지인 것이 되어버렸다. 이미 한번 공부한 내용이지만..
|
||||
|
||||
그래서 자소서를 쓸 때 고민이 되었다. 주위 친구들은 다들 수과학 내용을 위주로 썼는데, 나는 온통 다 반도체, 컴퓨터 연구 공부했던 내용, 나한테는 딴짓했던 내용이기 때문이다. 나한테는 논 것을 써내려가는 느낌이었다. 물론 쓰고 나서 객관적으로 바라보면 꽤 볼만한 자소서가 되어있었지만, 처음부터 써내려갈때에는 많이 괴롭고 고민되었다.
|
||||
|
||||
아직도 컴퓨터 공부는 뭔지 잘 모르겠다. 하지만 그게 정말 재미있고, 내 적성에 100% 맞다는 것만은 알고 있다. 앞으로는 컴퓨터에 대해서 제대로 공부하고 싶다. 그것은 고등학생 신분으로는 내 맘속에서 딴짓이라고 정의되어 버리므로, 일단은 대학을 가야 하구나 싶다.
|
||||
|
||||
야망이라는 말이 있다. 나는 항상 내 꿈을 말할 때 표현의 부족함을 느꼈다. 꿈이라고 하기에는 지극히 개인적이고 꿈보다 훨씬 이루고 싶고, 인생을 움직이는 원동력과도 비슷한 거니까. 물론 꿈을 사람마다 다르게 해석할 수 있다. 그게 꿈 아니야? 라고 할 수도 있다. 하지만 나에게는 꿈보다 훨씬 이루고 싶은 것이 있다. 컴퓨터라는 기계의 역사에 내 이름을 크게 남기는 것. 내가 생각했을 때는 꿈보다는 야망에 훨씬 가까운 내용이었다. 나는 컴퓨터의 패러다임을 바꾸고 싶다. 어쩌면 *Linus Torvalds*처럼, 혹은 벨 연구소와 IBM 연구소의 많은 사람들 처럼. 내 이름을 직접적을 남기지 않아도 내 작품이 두고두고 무언가의 기반이 되었으면 좋겠다. 내 작품을 컴퓨터 역사에 깊이 뿌리박히게 하는 것. 그게 내 야망이자 꿈인것 같다.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
내 야망을 이루기 위해서는 컴퓨터를 잘 알아야 할테지.. 컴퓨터라는 기계를 역사부터 원리까지 꿰뚫고 있어야 하겠지. 그것을 위한 여정은 매우 길고 또 험난하겠지. 하지만 운이 좋았다. 나는 그 과정이 정말로 재밌다. 놀지 말고 쉬지 말라고 해도 할 수 있다. 그게 내가 그것을 딴짓이라고 생각한 원인이니까.
|
||||
|
||||
그게 정말 강한 원동력이었던 것 같다. 컴퓨터 공부를 놀이라고 생각했던 것. 하지만 앞으로는 “공부”를 해야 할 것 같다. 슬금슬금 한계가 다가오고 있기도 했고, 무엇보다 그것만 하면서 살 수는 없으니까. 지금으로써 내가 할 수 있는 것은 이 마음을 잊지 않는 것. 꾸준히 생각하는 것. 기반 지식을 열심히 쌓는 것.
|
||||
|
||||
그리고 대학교 진학..
|
||||
0
content/personal/_index.md
Normal file
0
content/personal/_index.md
Normal file
Reference in New Issue
Block a user