| 149 | } |
| 150 | |
| 151 | export async function hashHex_f(string) { |
| 152 | const encoder = new TextEncoder(); |
| 153 | const data = encoder.encode(string); |
| 154 | const hashBuffer = await crypto.subtle.digest('SHA-256', data); |
| 155 | const hashArray = Array.from(new Uint8Array(hashBuffer)); |
| 156 | const hashHex = hashArray.map(byte => byte.toString(16).padStart(2, '0')).join(''); |
| 157 | return hashHex; |
| 158 | } |
| 159 | |
| 160 | /** |
| 161 | * Handles VLESS over WebSocket requests by creating a WebSocket pair, accepting the WebSocket connection, and processing the VLESS header. |