Skip to content

Commit c844352

Browse files
authored
Remove old sha512 code (#17618)
* Remove ICryptoUtils and CryptoUtils * News entry
1 parent 77d31bb commit c844352

File tree

9 files changed

+1
-219
lines changed

9 files changed

+1
-219
lines changed

news/3 Code Health/7333.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Remove unused SHA512 hashing code.

src/client/common/crypto.ts

Lines changed: 0 additions & 43 deletions
This file was deleted.

src/client/common/platform/fileSystem.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -471,8 +471,6 @@ export class FileSystemUtils implements IFileSystemUtils {
471471
}
472472
}
473473

474-
// We *could* use ICryptoUtils, but it's a bit overkill, issue tracked
475-
// in https://github.com/microsoft/vscode-python/issues/8438.
476474
export function getHashString(data: string): string {
477475
const hash = createHash('sha512');
478476
hash.update(data);

src/client/common/serviceRegistry.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import {
55
IAsyncDisposableRegistry,
66
IBrowserService,
77
IConfigurationService,
8-
ICryptoUtils,
98
ICurrentProcess,
109
IEditorUtils,
1110
IExperimentService,
@@ -59,7 +58,6 @@ import { WorkspaceService } from './application/workspace';
5958
import { AsyncDisposableRegistry } from './asyncDisposableRegistry';
6059
import { ConfigurationService } from './configuration/service';
6160
import { PipEnvExecutionPath } from './configuration/executionSettings/pipEnvExecution';
62-
import { CryptoUtils } from './crypto';
6361
import { EditorUtils } from './editor';
6462
import { ExperimentService } from './experiments/service';
6563
import {
@@ -161,7 +159,6 @@ export function registerTypes(serviceManager: IServiceManager): void {
161159
ITerminalActivationHandler,
162160
PowershellTerminalActivationFailedHandler,
163161
);
164-
serviceManager.addSingleton<ICryptoUtils>(ICryptoUtils, CryptoUtils);
165162
serviceManager.addSingleton<IExperimentService>(IExperimentService, ExperimentService);
166163

167164
serviceManager.addSingleton<ITerminalHelper>(ITerminalHelper, TerminalHelper);

src/client/common/types.ts

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -471,25 +471,6 @@ export interface IHashFormat {
471471
string: string; // If hash format is a string
472472
}
473473

474-
/**
475-
* Interface used to implement cryptography tools
476-
*/
477-
export const ICryptoUtils = Symbol('ICryptoUtils');
478-
export interface ICryptoUtils {
479-
/**
480-
* Creates hash using the data and encoding specified
481-
* @returns hash as number, or string
482-
* @param data The string to hash
483-
* @param hashFormat Return format of the hash, number or string
484-
* @param [algorithm]
485-
*/
486-
createHash<E extends keyof IHashFormat>(
487-
data: string,
488-
hashFormat: E,
489-
algorithm?: 'SHA512' | 'SHA256' | 'FNV',
490-
): IHashFormat[E];
491-
}
492-
493474
export const IAsyncDisposableRegistry = Symbol('IAsyncDisposableRegistry');
494475
export interface IAsyncDisposableRegistry extends IAsyncDisposable {
495476
push(disposable: IDisposable | IAsyncDisposable): void;

src/test/common/crypto.unit.test.ts

Lines changed: 0 additions & 143 deletions
This file was deleted.

src/test/common/installer.test.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ import {
2525
import { WorkspaceService } from '../../client/common/application/workspace';
2626
import { AsyncDisposableRegistry } from '../../client/common/asyncDisposableRegistry';
2727
import { ConfigurationService } from '../../client/common/configuration/service';
28-
import { CryptoUtils } from '../../client/common/crypto';
2928
import { EditorUtils } from '../../client/common/editor';
3029
import { ExperimentService } from '../../client/common/experiments/service';
3130
import {
@@ -93,7 +92,6 @@ import {
9392
IAsyncDisposableRegistry,
9493
IBrowserService,
9594
IConfigurationService,
96-
ICryptoUtils,
9795
ICurrentProcess,
9896
IEditorUtils,
9997
IExperimentService,
@@ -214,7 +212,6 @@ suite('Installer', () => {
214212
ITerminalActivationHandler,
215213
PowershellTerminalActivationFailedHandler,
216214
);
217-
ioc.serviceManager.addSingleton<ICryptoUtils>(ICryptoUtils, CryptoUtils);
218215
ioc.serviceManager.addSingleton<IExperimentService>(IExperimentService, ExperimentService);
219216

220217
ioc.serviceManager.addSingleton<ITerminalHelper>(ITerminalHelper, TerminalHelper);

src/test/common/moduleInstaller.test.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ import {
3131
import { WorkspaceService } from '../../client/common/application/workspace';
3232
import { AsyncDisposableRegistry } from '../../client/common/asyncDisposableRegistry';
3333
import { ConfigurationService } from '../../client/common/configuration/service';
34-
import { CryptoUtils } from '../../client/common/crypto';
3534
import { EditorUtils } from '../../client/common/editor';
3635
import { DiscoveryVariants } from '../../client/common/experiments/groups';
3736
import { ExperimentService } from '../../client/common/experiments/service';
@@ -94,7 +93,6 @@ import {
9493
IAsyncDisposableRegistry,
9594
IBrowserService,
9695
IConfigurationService,
97-
ICryptoUtils,
9896
ICurrentProcess,
9997
IEditorUtils,
10098
IExperimentService,
@@ -256,7 +254,6 @@ suite('Module Installer', () => {
256254
ITerminalActivationHandler,
257255
PowershellTerminalActivationFailedHandler,
258256
);
259-
ioc.serviceManager.addSingleton<ICryptoUtils>(ICryptoUtils, CryptoUtils);
260257
ioc.serviceManager.addSingleton<IExperimentService>(IExperimentService, ExperimentService);
261258

262259
ioc.serviceManager.addSingleton<ITerminalActivationCommandProvider>(

src/test/common/serviceRegistry.unit.test.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ import { WorkspaceService } from '../../client/common/application/workspace';
3030
import { AsyncDisposableRegistry } from '../../client/common/asyncDisposableRegistry';
3131
import { ConfigurationService } from '../../client/common/configuration/service';
3232
import { PipEnvExecutionPath } from '../../client/common/configuration/executionSettings/pipEnvExecution';
33-
import { CryptoUtils } from '../../client/common/crypto';
3433
import { EditorUtils } from '../../client/common/editor';
3534
import {
3635
ExtensionInsidersDailyChannelRule,
@@ -82,7 +81,6 @@ import {
8281
IAsyncDisposableRegistry,
8382
IBrowserService,
8483
IConfigurationService,
85-
ICryptoUtils,
8684
ICurrentProcess,
8785
IEditorUtils,
8886
IExtensions,
@@ -130,7 +128,6 @@ suite('Common - Service Registry', () => {
130128
[INugetService, NugetService],
131129
[ITerminalActivator, TerminalActivator],
132130
[ITerminalActivationHandler, PowershellTerminalActivationFailedHandler],
133-
[ICryptoUtils, CryptoUtils],
134131
[ITerminalHelper, TerminalHelper],
135132
[ITerminalActivationCommandProvider, PyEnvActivationCommandProvider, TerminalActivationProviders.pyenv],
136133
[ITerminalActivationCommandProvider, Bash, TerminalActivationProviders.bashCShellFish],

0 commit comments

Comments
 (0)